The first vignette introduces the data that alerted us to rapid CO2 increases in the atmosphere. Charles Keeling began monitoring atmospheric CO2 from atop Mauna Loa in 1958. The site was selected to be remote from local variation, aiming for a global perspective. It came to represent one of the most immediate and persuasive arguments that change is happening fast. The Mauna Loa CO2 data will provide an opportunity to work directly with the data that have been in media on climate change and its consequences.

Activities today

  1. Introductions
  2. Review goals for this semester
  3. Field trip: Kruger National Park, see SSLI orientation package on Canvas
    • Arrive in Johannesburg on 7 March
    • Depart from Johannesburg on 15 March
  4. Four landscapes
  5. Gain experience with R using Mauna Loa C02 data

Goals

  1. Articulate
    • changes happening now in climate and biodiversity
    • where it came from
    • what we can expect for the future
  2. Understand the tools used in global change science
    • Data collection
    • Analysis
  3. Critically evaluate the evidence
  4. Apply R to global change data to model and interpret

Resources

  1. Get started with R: work through the intro to R here

  2. CO2 data from Mauna Loa trace buildup of greenhouse gasses. Work through this vignette and stop when you get to the section The Law Dome Ice Core Record (longer term trends that we’ll pick up on later).

For next class

  1. Readings:
  2. R: The next class meeting will check in on the analysis of the Mauna Loa data. Start with the background on R here. Then try the Halverson vignette on your own. Again, stop when you get to the section The Law Dome Ice Core Record. The Halverson vignette contains explanation and code in R to be implemented in Rstudio. Post your questions on this vignette and the R tutorial to Canvas Discussion in advance of the next meeting.

For end of class today

This block of R code will extract long-term CO2 concentrations at the Mauna Loa observatory from the NOAA ftp site:

library( lubridate )
mw <- read.table('ftp://aftp.cmdl.noaa.gov/products/trends/co2/co2_weekly_mlo.txt')

# select columns and assign new names
mw <- mw[, c(1, 2, 3, 5)]
names(mw) <- c('year', 'month', 'day', 'co2ppm')

# date format
mw$date <- as.Date(paste(mw$year, mw$month, mw$day, sep = '-'), format = '%Y-%m-%d')
mw$time <- decimal_date( mw$date ) 

# retain necessary columns
mw <- mw[, c('date', 'year', 'time', 'co2ppm')]

# missing values
mw[mw$co2ppm == -999.99, ]$co2ppm = NA

Here are the first few rows:

Data in mw
date year time co2ppm
1974-05-19 1974 1974.378 333.37
1974-05-26 1974 1974.397 332.95
1974-06-02 1974 1974.416 332.35
1974-06-09 1974 1974.436 332.20
1974-06-16 1974 1974.455 332.37

Make a plot:

par( mfrow = c(1,2), bty = 'n' )
plot(mw$date, mw$co2ppm, type = 'l',
     xlab = 'Year', ylab = 'CO2 Concentration (ppmV)',
     main = 'Mauna Loa Weekly' )

# annual averages
plot( mw$time, mw$co2ppm, type = 'l', col = 'grey', lwd = 2,
      xlab = 'Year', ylab = '', main = 'Annual mean')
annual <- tapply( mw$co2ppm, mw$year, mean, na.rm = T )
lines( as.numeric( names( annual ) ), annual, col = 2, lwd = 2)

Here’s a plot of each year:

par( bty = 'n' )
plot( NA, xlim = c(0, 1), ylim = range( mw$co2ppm, na.rm=T ), 
      xlab = 'Month', ylab = 'ppmv', xaxt = 'n', las = 1 )
month <- seq(0, 12, by = 2 )
axis(1, at = month/12, labels = month )
years <- sort( unique( mw$year ) )
cols <- colorRampPalette( c('#d53e4f','#fc8d59','#fee08b',
                            '#e6f598','#99d594','#3288bd') )
cols <- cols( length(years) )
for( j in 1:length(years)){
  wj <- which( mw$year == years[j] )
  lines( mw$time[wj] - years[j], mw$co2ppm[wj], col = cols[j] )
}

Assignment for next time

  1. Execute the last block of code line by line and comment each line. This activity will require the help() function. You will need to check each object with functions like head or tail.

  2. Explain what the graph means, including colors.