ETC5521 Tutorial 11

Exploring spatiotemporal data

Author

Prof. Di Cook

Published

October 12, 2023

🎯 Objectives

This tutorial practices rearranging spatiotemporal data to focus on spatial or temporal patterns, and constructing choropleth maps and cartograms.

🔧 Preparation

install.packages(c("tidyverse","here","lubridate","GGally","tsibble","forcats","cartogram","sf","cartogram","patchwork","ggthemes", "sugarbag", "viridis", "rmapshaper"))
remotes::install_github("runapp-aus/strayr")
remotes::install_github("huizezhang-sherry/cubble")
  • Open your RStudio Project for this unit, (the one you created in week 1, eda or ETC5521).

Exercise 1: Gridded spatiotemporal data

Conduct a spatiotemporal analysis of ozone measurements over central America, following the analysis of temperature provided in the class lecture notes.

a. Make a single map

Load the nasa data from the GGally package, and make a map of ozone for January 2015, overlaid on a map of the geographic area. What do you learn about the spatial distribution of ozone?

The high concentrations of ozone are at the highest latitude. The lowest are close to the equator, and there is a small increase in values in the southern hemisphere. The trend is primarily north-south, and doesn’t change between land and sea.

data(nasa) # from GGally packge

nasa_cb <- as_cubble(as_tibble(nasa), 
                     key=id, 
                     index=time, 
                     coords=c(long, lat))

sth_america <- map_data("world") %>%
  filter(between(long, -115, -53), between(lat, -20.5, 41))
nasa_cb %>% face_temporal() %>%
  filter(month == 1, year == 1995) %>% 
  select(id, time, ozone) %>%
  unfold(long, lat) %>%
  ggplot() + 
  geom_tile(aes(x=long, y=lat, fill=ozone)) +
  geom_path(data=sth_america, 
            aes(x=long, y=lat, group=group), 
            colour="white", linewidth=1) +
  scale_fill_viridis_c("ozone", option = "magma") +
  theme_map() +
  theme(legend.position = "bottom") +
  ggtitle("January 1995")