--- title: Lighthouses of the Great Lakes author: Rob Wiederstein date: '2021-03-07' slug: great-lakes-lighthouses categories: - R tags: - leaflet layout: layouts/post/single draft: no bibliography: [packages.bib, ../blog.bib] csl: ../ieee-with-url.csl link-citations: true nocite: | @R-base, @R-blogdown header: image: feature.jpg alt: black and white lighthouse in Luddington State Park caption: Big Sable Point Lighthouse. Photo by James Phelps from USA, CC BY 2.0 via Wikimedia Commons. summary: This post uses the United States Coast Guard data to plot navigation aides. Many observations were dropped for incomplete data, but those with a dwelling were colored differently. Buoys were omitted too. repo: https://raw.githubusercontent.com/RobWiederstein/purple-bananas/main/content/post/2021-03-07-michigan-lighthouses/index.Rmd --- ```{r load-packages, include = F} ## Load frequently used packages for blog posts x <- c( 'devtools', #for session info 'ggthemes', #for plots 'blogdown', 'knitr' ) lapply(x, library, character.only = T) ``` ```{r set-chunk-options, include = F} ## Do not break chunk line ## Do not use spaces or periods "." or underscores "_" ## set options for knitr knitr::opts_chunk$set( comment = '', fig.width = 6, fig.asp = .8, fig.align="center", message=F, error=F, warning=F, tidy=T, comment='', cache=T, dev='svg', echo=F ) ``` ```{r set-ggplot-theme-defaults, include = F} #from ggthemes library(ggplot2); theme_set(ggthemes::theme_fivethirtyeight()) ``` ```{r define-color-palette, include = F, eval = T} # color blind friendly palette from http://www.cookbook-r.com/Graphs/Colors_(ggplot2)/ cbPalette <- c("#E69F00", "#56B4E9", "#009E73", "#F0E442", "#0072B2", "#D55E00", "#CC79A7", "#000000") ``` ```{r} # write packages used to bib in current directory knitr::write_bib(.packages(), "./packages.bib") ``` ## Overview This post seeks to identify prominent lighthouses and navigational aids along the coasts and waterways of the Great Lakes. The U.S. Coast Guard's "Light List" is used for the descriptive analysis. ## Background ### International Standards The International Association of Lighthouse Authorities (IALA) endorsed two maritime buoyage systems in 1977. [@internationalassoc.lighthouseauthoritiesMaritimeBuoyageSystem2021] The systems, designated as "A" and "B", displaced a multitude of country-level systems. The Americas, including the U.S. and Canada, are in Region B. The greatest difference between the two systems is that in Region B, red markers are on the right whereas in Region A, red makers are on the left. All navigational aids within IALA have four characteristics: shape, light, color and topmark. A "Lighthouse" is defined as "a tower, or substantial building or structure, erected at a designated geographical location to carry a signal light and provides a significant daymark. It provides a long or medium range light for identification by night." #### Shapes The standard buoy shapes are cylindrical (can), conical (nun), spherical, pillar and spindle. #### Color The colors are either "W" white, "R" red, "G" green, "Y" yellow, "O" orange or "Bu" blue. The default color is white. #### Light Navigational aids can be either lit or not. When lit, the light can be continuous or flashing. When flashing, the light is further described as isophase or occulting. The time of the light cycle is often used for further identification. ### U.S. Coast Guard Light List The U.S. Coast Guard maintains a "light list" which is published annually. The light list is an inventory of navigation aides including all lights, sound signals, buoys, day beacons, and other aids. The data is available in both `.pdf` and `.xml`. The 2021 data is for the ninth district known as the "Great Lakes and the St. Lawrence River above the St. Regis River". [@unitedstatescoastguardWeeklyLightLists2021] A code sheet is included within the annual light list report. Of interest for this analysis is the "height" column. "Height" is defined for the Great Lakes as "height above water from the focal plane of the fixed light to low water datum, listed in feet and meters." "Range" is defined as the "nominal range of lighted aids to navigation, in nautical miles, listed by color for sector and passing lights. Nominal Range is not listed for ranges, directional lights, or private aids to navigation." "Structure" is defined as "the structural characteristic of the aid to navigation, including: dayboard (if any), description of fixed structure, color and type of buoy, height of structure above ground for major lights." Commercial vessels are required to maintain on board a current copy of the U.S. Coast Guard Light List. ```{r load-libraries, include = F} x <- c("tidyverse", "leaflet", "data.table", "tibble", "htmlwidgets", "leaflet.providers") lapply(x, library, character.only = T) ``` # Load the Data The USCG Light List contains in excess of 4500 navigational aids in District 9. Much of the data is missing, particularly for aids like buoys in secondary channels. For instance, there would seem to be little need to record the height and range of a channel buoy that is sitting at sea level. Structures that contained the term "buoy" were eliminated from the data set. ```{r missingness-plot-full-data, fig.cap="Full USCG Light List--Great Lakes Region.", out.width="100%"} knitr::include_graphics(path="./missing-data.jpg") ``` ```{r import-data, echo = F, cache=T} #datasets hosted in dropbox input <- "https://dl.dropbox.com/s/lpyt4bxerzpao1b/2021-03-01-uscg-dist-9-light-list-partial.csv?dl=0" df <- as_tibble(data.table::fread(input = input)) df$dwelling <- factor(df$dwelling, labels = c("yes", "no")) ``` The final data set was winnowed to `r nrow(df)` observations. The most significant variable was the range that the navigational aid could be seen while on the water. The range could be a proxy for the importance of the aid to boating traffic. Another closely related variable was the "height" variable. The higher a light was from the earth, the easier it was to be seen on the horizon. Thus, height would seem to be a predictor of range. The chart below shows the correlation between the two variables. ```{r plot-range-height, messages = F, warnings = F, out.width="100%",fig.cap="Plot showing the connection between height and range."} p <- ggplot(df, aes(height, range, group = dwelling, color = dwelling)) p <- p + geom_point() p <- p + ggtitle("USCG Nav. Aids -- Buoys Omitted") p <- p + geom_smooth() p <- p + scale_x_continuous(name = "height", limits = c(0, 200) ) p <- p + scale_color_manual(values = cbPalette) p <- p + theme(axis.title = element_text()) + xlab('height (ft)') + ylab('range (nm)') p ``` # Leaflet Plot The `leaflet` package in `R` was used to map the navigational aids. [@R-leaflet]Latitude and longitude were furnished as part of the data set. To add greater detail and utility to the data, a spatial plot was generated. Light aids where a "dwelling" was included in the structure variable were assigned a different color for the marker. Only twenty of the navigational aids had a dwelling attached. There were no dwellings attached to a light where its height was less than 50 feet. Additionally, the size of the marker was set based on the range of the light. The range of the lights was between 3 and 25 nautical miles. The median range was `r median(df$range)`. ```{r leaflet-lighthouse-map, fig.cap="Upper Lake Michigan"} dwellingCol <- colorFactor(palette = c("#FFC20A", "#0C7BDC"), df$dwelling) library(leaflet) m <- leaflet() %>% #addProviderTiles(providers$CartoDB.Positron) %>% addTiles()%>% setView(lng = -86.83, lat = 44.641, zoom = 8) %>% addCircleMarkers(lng = df$longitude, lat = df$latitude, color = dwellingCol(df$dwelling), radius = df$range, popup = paste("Aid name: ", df$aid_name, "
", "Structure: ", df$structure, "
", "Characteristic: ", df$characteristic, "
", "Height: ", df$height, "
", "Range: ", df$range, "
") ) m ``` # Conclusion The points plotted are from the USCG list and a large portion of the data set was omitted due to incomplete data. The residual show broad coverage across the Great Lakes with greater density in places where ports are located, narrow channels or prominent points of land. Only twenty of the light aids are attached to a dwelling. ## Acknowledgements This blog post was made possible thanks to: ## References
## Disclaimer The views, analysis and conclusions presented within this paper represent the author’s alone and not of any other person, organization or government entity. While I have made every reasonable effort to ensure that the information in this article was correct, it will nonetheless contain errors, inaccuracies and inconsistencies. It is a working paper subject to revision without notice as additional information becomes available. Any liability is disclaimed as to any party for any loss, damage, or disruption caused by errors or omissions, whether such errors or omissions result from negligence, accident, or any other cause. The author(s) received no financial support for the research, authorship, and/or publication of this article. ## Reproducibility ```{r reproducibility, echo = FALSE} ## Reproducibility info options(width = 120) session_info() ```