knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "##",
  fig.path = "man/figures/README-",
  out.width = "100%",
  message = FALSE,
  warning = FALSE
)

Travis build status Coverage status CRAN status

iceout

Freeze/Thaw Phenology Data of Global Lake and River Ice

Description

The term phenology in the data set title refers to the seasonal phenomenon of the freezing and thawing of lake and river ice (also known as 'ice-in'/'ice-out' and 'ice-on'/'ice-off' data. Ice-out dates, or the dates of ice break-up, are the annual dates in spring when winter ice cover leaves an inland body of water. Methods are provides to enable convenient access to New England iceout data from the USGS and Minnesota iceout data from the MDNR along with extra Maine state data from MDACF and a comprehensive global dataset (to 2014) from the NSIDC.

Contents

The following functions are provided:

The following datasets are provided:

Installation

You can install the development version of iceout via:

devtools::install_github("hrbrmstr/iceout") # this fork
# or
devtools::install_github("BigelowLab/iceout") # the original

Usage

library(iceout)
library(hrbrthemes) # devools install req
library(tidyverse)

# current version
packageVersion("iceout")

NSIDC Data

(NOTE: the convience plotting function doesn't work with this dataset)

data(nsidc_iceout)

nsidc_iceout

The NSIDC data has quite a bit of global coverage:

maps::map("world", ".", exact = FALSE, plot = FALSE, fill = TRUE) %>%
  fortify() -> wrld

ggplot() + 
  ggalt::geom_cartogram(
    data = wrld, map = wrld, aes(long, lat, map_id=region), 
    fill="#3B454A",  color = "white", size = 0.125
  ) +
  geom_point(
    data = distinct(nsidc_iceout, lakeorriver, longitude, latitude),
    aes(longitude, latitude, fill = lakeorriver), 
    size = 1.5, color = "#2b2b2b", stroke = 0.125, shape = 21
  ) +
  scale_fill_manual(
    name = NULL, values = c("L"="#fdbf6f", "R"="#1f78b4"), labels=c("L" = "Lake", "R" = "River")
  ) +
  ggalt::coord_proj("+proj=wintri", ylim = range(nsidc_iceout$latitude, na.rm = TRUE)) +
  ggthemes::theme_map() +
  theme(legend.position = c(0.375, 0.1))

Let's look at some US data:

filter(nsidc_iceout, country == "United States", state == "ME") %>%
  mutate(iceout_date = as.Date(sprintf("2020-%s-%s", iceoff_month, iceoff_day))) %>% # leap year for y axis plotting
  ggplot(aes(iceoff_year, iceout_date)) +
  geom_point(aes(color = lakecode), show.legend = FALSE, size = 0.25, alpha=1/4) +
  geom_smooth(aes(group = lakecode, color = lakecode), se = FALSE, size = 0.25, show.legend = FALSE) +
  labs(
    x = NULL, y = "Ice-out Day", 
    title = "Historical Ice-out Dates for Maine",
    subtitle = "Source: Global Lake and River Ice Phenology Database, Version 1",
    caption = "Source link: https://nsidc.org/data/G01377"
  ) +
  theme_ft_rc(grid="XY")
filter(nsidc_iceout, country == "United States", state == "NY") %>%
  mutate(iceout_date = as.Date(sprintf("2020-%s-%s", iceoff_month, iceoff_day))) %>% # leap year for y axis plotting
  ggplot(aes(iceoff_year, iceout_date)) +
  geom_point(aes(color = lakecode), show.legend = FALSE, size = 0.25, alpha=1/4) +
  geom_smooth(aes(group = lakecode, color = lakecode), se = FALSE, size = 0.25, show.legend = FALSE) +
  labs(
    x = NULL, y = "Ice-out Day", 
    title = "Historical Ice-out Dates for New York",
    subtitle = "Source: Global Lake and River Ice Phenology Database, Version 1",
    caption = "Source link: https://nsidc.org/data/G01377"
  ) +
  theme_ft_rc(grid="XY")

USGS Data

data(usgs_iceout)

usgs_iceout

Maine state curated data

data(me_iceout)

me_iceout

Minnesota state curated data

data(mn_iceout)

mn_iceout

Visualization

USGS

plot_iceout("usgs", "New Hampshire", "First.Conn")

Maine-curated

plot_iceout("me", "Maine", "Long Pond", town = "Belgrade")

Minnesota-curated

plot_iceout("mn", "Minnesota", "Minnewaska")

Exploring USGS Data

Where are the USGS study lakes?

library(ggrepel)
library(hrbrthemes) # requires github/hrbrmstr/hrbrthemes ?(for the dark theme)
library(worldtilegrid) # requires github/hrbrmstr/worldtilegrid (for the theme cleaner)

# get ME+NH+MASS map
maps::map("state", ".", exact = FALSE, plot = FALSE, fill = TRUE) %>%
  fortify() %>%
  filter(region %in%  c("maine", "new hampshire", "massachusetts")) %>%
  as_tibble() -> st

ggplot() +
  geom_polygon(
    data = st, aes(long, lat, group=group),
    fill = ft_cols$slate, color = "white", size = 0.125
  ) +
  geom_label_repel(
    data = distinct(usgs_iceout, state, body_name, lon, lat), 
    aes(lon, lat, label=body_name), size=3
  ) +
  coord_quickmap() +
  theme_ft_rc(grid="") +
  worldtilegrid::theme_enhance_wtg()
filter(usgs_iceout, body_name == "Rangeley") %>% 
  pull(lat) %>% 
  unique()  %>% 
  round(2) -> focused_lat

filter(usgs_iceout, lat >= focused_lat) %>% 
  mutate(
    dm = sprintf(
      "2020-%02s-%02s", # use a leap year
      lubridate::month(date),
      lubridate::day(date)
    ),
    dm = as.Date(dm)
  )%>% 
  ggplot(aes(date, dm, group=body_name, color=body_name)) +
  geom_smooth(method = 'loess', size=0.25, se = FALSE) +
  geom_point(size=0.75, alpha=1/3) +
  labs(
    x = NULL, y = "Ice-out Month/Day", color = NULL,
    title = sprintf(
      "Ice-out Trends for lakes at latitude %s and higher", focused_lat
    )
  ) +
  theme_ft_rc(grid="Y")

iceout Metrics

cloc::cloc_pkg_md()

Code of Conduct

Please note that the 'iceout' project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.



BigelowLab/iceout documentation built on May 26, 2019, 1:34 a.m.