The National Oceanic and Atmospheric Association (NOAA) of the National Centers for Environmental Information (NCEI) provides public access to some weather data, including the GHCN (Global Historical Climatology Network)-Daily database of summary statistics from weather stations around the world.
These data were accessed from the NOAA National Climatic Data Center, http://doi.org/10.7289/V5D21VHZ (Menne, M.J., I. Durre, B. Korzeniewski, S. McNeal, K. Thomas, X. Yin, S. Anthony, R. Ray, R.S. Vose, B.E.Gleason, and T.G. Houston, 2012: Global Historical Climatology Network - Daily (GHCN-Daily), Version 3.22).
set.seed(8)
ny_noaa <-
ny_noaa %>%
sample_n(99999) %>%
janitor::clean_names() %>%
drop_na() %>%
separate(col = date,
into = c("year","month", "day")) %>%
mutate(across(.cols
= c(year, month, day), as.integer)) %>%
mutate(month = month.name[month]) %>%
mutate(snow = as.numeric(snow),
tmax = as.integer(tmax)/10,
tmin = as.integer(tmin)/10)
ny_noaa %>%
mutate(month =
fct_reorder(month, tmin)) %>%
group_by(year, month, id) %>%
summarize(mean_tmin = mean(tmin)) %>%
plot_ly(x = ~ month,
y = ~ round(mean_tmin, digits = 0),
color = ~ month,
alpha = 0.6,
type = "box",
colors = "inferno") %>%
layout(
title =
"Average Minimum Temperature per Month",
xaxis = list(title = "Month"),
yaxis = list(title = "Mean Minimum Temperature (Celcius)"))
ny_noaa %>%
count(snwd) %>%
filter(snwd > 0) %>%
plot_ly(x = ~ snwd,
y = ~ n,
type = "bar",
color = "inferno") %>%
layout(
title =
"Snow Depth Count (Snow Days Only)",
xaxis = list(title = "Snow Depth (mm)"),
yaxis = list(title = "Count (n)"))
ny_noaa %>%
filter(year == 2010) %>%
mutate(text_label = str_c("Max Temperature: ", tmax,
", Min Temperature: ", tmin,
", Date: ", month," ", day,", ", year)) %>%
plot_ly(x = ~ tmin,
y = ~ tmax,
alpha = 0.6,
color = ~ month,
colors = "inferno",
text = ~ text_label) %>%
layout(title = "Minimum Temperature versus Maximum Temperature (2010)",
xaxis = list(title = "Minimum temperature (Celcius)"),
yaxis = list(title = "Maximum temperature (Celcius)"))
Click here to return to the main page.