--- title: "Lab 2: Investigating Evidence for Climate Change, Part 2: The Geologic Record" author: "YOUR NAME HERE" date: "ADD DATE" output: html_document: theme: spacelab toc: true toc_depth: 2 number_sections: true toc_float: collapsed: false smooth_scroll: true --- ```{r setup, include=FALSE} # FOR STUDENTS CHANGE THESE SETTINGS TO TRUE SO THE OUTPUT OF ALL CODE CHUNKS WILL PRINT!!! # modify html output: # this code creates default chunk options and applies the same settings to all chunks in the document. The default can be modified in individual chunks. # code from: https://stackoverflow.com/questions/47710427/how-to-show-code-but-hide-output-in-rmarkdown/51409622 # modify universal code options here. knitr::opts_chunk$set(echo= FALSE, # TRUE to show code in HTML, FALSE to hide code eval= FALSE) # TRUE to evaluate code and display output in HTML, FALSE to suppress output ``` # Instructions This lab is in two parts: * PartI focuses on modern global temperature and atmospheric CO2 * PartII focuses on the Ice Core record with geologic history of temperature and CO2. PartII also includes the modern $\delta$ 13C atmospheric record for additional evidence of anthropogenic climate change. ## Setup * create a folder EcosystemEcology/Lab2 on your computer * download Lab2_AllData.xlsx and the .Rmd file to this folder! * Use 'save as' to save the file with a new name to create your own .Rmd and add your answers: + save as: Lab2_Assignment_partI_LASTnameFIRSTname.Rmd and .html ## Doing the lab * read through this assignment sheet so you know what the lab involves * choose whether you want to do the assignment with or without helper code * load data into R * Answer questions showing: + code + inserting supporting figures + provide explanations * for maximum points, answer in *full sentences* using appropriate *units*, *figure axis labels*, and descriptive *figure titles* * submit as .html (zipped if getting security error) and as .Rmd file in Blackboard * **IMPORTANT:** when you open the Rmd file in the first code chunk called {r setup, include = FALSE} change the settings to echo = TRUE and eval = TRUE to make sure your output shows. It needs to look like this: `knitr::opts_chunk$set(echo= TRUE, eval= TRUE)` ## DUE * part I: September 9 * part II: September 13 # Lab Outline 1. **Activity A:** Determine current rates of air temperature and CO2 change from modern datasets 2. **Activity B:** Explore whether modern temperature and CO2 concentrations are related 3. **Activity C:** Compare current and pre-historical temperature and CO2 concentrations using data from the Vostok ice core 4. **Activity D:** Use modern atmospheric isotopic $\delta$ 13C data to examine supporting evidence that the current rise in CO2 comes from fossil fuel emissions # The Datasets: 1. Modern Global Temperature means and anomalies 2. Atmospheric CO2 concentrations from Mauna Loa 3. Atmospheric $\delta$ 13C signatures from Mauna Loa 4. Vostok Ice Core geologic record of global temperature and CO2 concentration # Load libraries and import data to R ## Load required libraries ```{r, load libraries, message=FALSE, error=FALSE, echo=TRUE, eval=TRUE} library(dplyr) library(ggplot2) library(readxl) # use install.packages("readxl") or install manually in Packages tab ``` ## Confirm your working directory The first step for opening data in R is to tell R which folder on your computer contains the data. The folder that R reads is called 'the working directory' or wd. You can use the command `getwd()` to find out which folder R is currently looking at. It will be easiest if you save the data and your .Rmd in the same folder because the default wd is the directory that your R script file comes from. If the data and .Rmd are in the same place, you won't need to change anything. Confirm that your wd is the folder where your data is saved: ```{r, check working directory} getwd() ``` ## Import the data OK, ready to import data. Read the data from the excel sheet by specifying which sheet and which line the data starts on. We're going to load all the data for the entire assignment in this step. I like to set-up my code this way, so that I can see all the data I plan to use by looking at the beginning of my R script. Each dataframe that we create should show up in your environment. ```{r, import all data, message=FALSE, echo = TRUE, eval=TRUE} setwd("/Users/memauritz/Desktop/R/R_programs/Teaching/EcosystemEcology_UTEP/Lab2_Data") modern.c13 <- read_excel("Lab2_AllData.xlsx", sheet="MaunaLoa_Monthly_C13", skip=54, na=c("-99.99")) vostok.temp <- read_excel("Lab2_AllData.xlsx", sheet="Vostok_Temp", skip=1, na=c("-99.99")) vostok.co2 <- read_excel("Lab2_AllData.xlsx", sheet="Vostok_CO2", skip=1, na=c("-99.99")) ``` ## Do a simple check to see whether the data imported correctly Use `%>% glimpse` to see the column names and the column type. All of our data is numeric so all the column types should be < dbl >. You can also check this in the excel file to see how R reads data. Modern $\delta$ 13C signature data set ```{r, view modern 13C, eval=TRUE} # modern.c13 ADD glimpse here (refer to part I) ``` Vostok Ice Core Temperature data set ```{r, view Vostok temperature, eval=TRUE} # vostok.temp ADD glimpse here (refer to part I) ``` Vostok Ice Core CO2 concentration data set ```{r, view Vostock CO2,eval=TRUE} # vostok.co2 ADD glimpse here (refer to part I) ``` # An easy way to see column names When trying to remember the names of columns to graph or analyse your data, you can use `colnames(data)` anytime for a quick reminder of what's in a data frame. Eg: ```{r, colnames, echo=TRUE, eval=TRUE} colnames(modern.c13) ``` # Question Set ## **Activity A: (see part I)** ## **Activity B: (see part I)** ## **Activity C:** **Compare current and pre-historical temperature and CO2 concentrations using data from the Vostok ice core** There are three variables that you will analyse from the ice cores. You will graph temperature anomalies and absolute temperatures to compare with the modern records. You will also analyze pre-historic atmospheric CO2 concentration, which has been measured from air bubbles trapped in the ice. We can use these data to see what temperatures and CO2 concentrations were like 400 000 years into the past, during which human activity has been minimal. ### Graph the temperature anomaly recorded in the Vostok ice core Use vostok.temp dataframe and the column Temp_anom_C_vost **Do the following:** a. the years are in Years_BP (that's years before present) and go back to 420 000 BP. Divide the years by 1000 in the x-axis so that the unit becomes kyr BP b. add Temp_anom_C_vost with both a point and a line geom c. add a zero line for reference, like you did for the modern temperature anomaly d. add a blue dashed vertical line and label for the start of the Holocene 11 kyr ago using: `+ geom_vline(xintercept=11, colour="blue", linetype="dashed")` `+ geom_label(label="Holocene start",x=17,y=5)` e. specify the range of the y-axis `+ ylim(xmin=-10, ymax=5)` f. add meaningful titles and axis labels Graph Vostok temperature anomalies: [Graph Here] ```{r, graph Vostok temperature anomaly} ggplot(ADD CORRECT DATA FRAME, aes(x= Year_BP/1000, y= ))+ geom_ADD()+ geom_ADD() + geom_hline(yintercept= , colour="")+ # ADD INTERCEPT VALUE OF HORIZONTAL LINE and COLOUR according to instructions geom_vline(xintercept=11, colour="blue", linetype="dashed")+ geom_label(label="ADD LABEL NAME in INSTRUCTIONS",x=17,y=5)+ ylim(xmin=-10, ymax=5) + labs(title = "ADD TITLE", x="ADD NAME", y= "ADD NAME") ``` ### OK. This is a complex dataset, let's navigate this figure for a moment. An important thing to note is that Year 0 represents 1998 because that is when the ice core was collected. The years on the x-axis of this figure go from 0 to 400 BP (in 1000's of years). This is backwards compared to how we are used to seeing time on a graph (eg: compare the modern graphs). It means that the furthest left is the most recent time and as you move right on the x-axis you go further and further back in time, through multiple ice-ages. **Answer the following:** a. The periods with positive anomalies peaks represent major inter-glacial periods when the entire planet was ice-free. Glacial/Inter-glacial periods re-occur approximately every 100 kyr. Based on the graph, what is a typical magnitude of the temperature anomalies in the inter-glacial past (~400 kyr BP, 300 kyr BP, 200 kyr BP, 100 kyr BP)? b. We added a blue dashed line at 11 kyr BP and a label to mark the start of the Holocene (that's the epoch we are in right now). What can you say about the magnitude and variation of temperature anomalies since the start of the Holocene? *Careful of which direction to read the x-axis*. ### Now, let's look at Glacial/Inter-glacial CO2 concentrations **Do the following:** a. Graph the pre-historic atmospheric CO2 concentrations from the Vostok core using vostok.co2 and the column co2_ppmv_vost vs the age of gas in the ice (Gas_age_yrBP/1000) with a point and line geom b. add a vertical blue dashed line and a label for Holocene, as we did for the temperature anomaly. You will want to change the y-location of the label to 300, ie: `geom_label(label="", x=17, y=300)` Graph Vostok CO2 concentrations: [Graph Here] ```{r, graph Vostok CO2 concentration} ggplot(ADD CORRECT DATA FRAME HERE, aes(x= , y= ))+ geom_ADD()+ geom_ADD()+ geom_vline(xintercept=11, colour="blue", linetype="dashed")+ geom_label(label="ADD LABEL",x=17,y=300)+ labs(title = "ADD TITLE", x="ADD NAME", y= "ADD NAME") ``` **Answer the following:** c. What are the maximum pre-historic CO2 concentrations during the periods with large positive temperature anomalies (~400 kyr BP, 300 kyr BP, 200 kyr BP, 100 kyr BP)? d. Describe how CO2 fluctuations compare to the temperature anomaly fluctuations in the Ice Core data? Think generally about patterns, for example timing of peaks and troughs in the graphs. *You could re-print the both the temperature anomaly graph and the co2 graph in the same chunk and R will let you flip between the two. It might be easier to compare.* ```{r, display both Vostok CO2 concentration AND temperature anomaly} # ggplot of Vostok temperature anomaly # ggplot of vostok CO2 ``` ### Calculate the rate of temperature change in the Vostok ice core since the last Ice Age. The Earth started to emerge from the last Ice Age ~18 kyr BP. Notice that the transitions from Glacial (Ice Age) to Inter-Glacial appears to happen very rapidly. Zoom in on temperature anomalies and CO2 concentration from the time that Earth emerged form the last Ice Age period to enter the Holocene and up to 1998 (Year 0). Then, calculate the linear rates of change for temperature and CO2 concentration. We will want to use the **actual temperature** for the rate of change calculation, not the anomaly. **Do the following:** a. Use `filter(Year_BP/1000 <= 18)` to select Vostok data from the last 18 000 years and then graph actual temperature (that's column: Temp_C_vost in vostok.temp) for the last 18 kyr, with point and line geom. b. Estimate the rate of temperature change from 18-11 kyr ago. Instead of using `lm()` to determine the rate of temperature change, estimate the rate of change from the graph. Use the graph to visually estimate temperatature change from the approximate end of the last Ice age (18 000 yr ago) to the approximate start of the Holocene (11 000 yr ago). Then, calculate the *rate* of change. For temperature, use the absolute value of the difference (Ie: ignore the negative number). Show how you used R to do the math and report the estimated rate of temperature change from 18-11 kyr ago, make sure to include units (*hint: temp/time*). d. Compare the annual rate of temperature change from modern times (since 1880 to 1950) with the pre-historic rate of change from the last Ice Age Transition. Graph actual Vostok temperatures from 18 kyr BP to present (1998): [INSERT GRAPH] ```{r, graph actual Vostok temperature since 18 kyr BP} vostok.temp %>% filter(ADD COLUMN (remember the /1000) <= ADD FILTER VALUE) %>% ggplot(., aes(Year_BP/1000, Temp_C_vost))+ geom_point()+ geom_line() + geom_vline(xintercept=11, colour="blue", linetype="dashed")+ labs(title = "ADD TITLE", x="ADD NAME", y= "ADD NAME") ``` **Hint for rate of change estimate** Remember that the rate of change is given by the following formulas, and the relevant values can be visually estimated on a graph: $\frac{rise}{run} = \frac{change(y)}{change(x)} = \frac{y2-y1}{x2-x1}$ Visually estimate and calculate rate of temperature change from 18 to 11 kyr ago. Remember the years are in the 1000's so use the 1000s numbers, not the ones shown on the graph!!: [SHOW CALCULATION FOR VISUAL ESTIMATE OF TEMPERATURE CHANGE RATE] ```{r, manual rate of change calculation} change_y <- abs((y2) - (y1)) change_x <- x2-x1 change_y/change_x ``` ##**Activity D:** **Use modern atmospheric isotopic $\delta$ 13C data to examine supporting evidence that the current rise in CO2 comes from fossil fuel emissions.** How do we know warming and rising CO2 are *caused* by humans?! Evidence for climate change is based on data that includes what we have explored here. These meticulously gathered temperature and CO2 data show how temperature and CO2 fluctuate together. We can also use other data like the isotopic signature of CO2 in the atmosphere to determine whether rising CO2 in the atmosphere is consistent with isotopic signals we expect to see with increasing fossil-fuel contribution. **Do the following:** a. Use the Mauna Loa $\delta$ 13C data to graph the change in 13C signature. Use the column C13_smooth in modern.c13. Graph with a point geom. Add a title and axis labels. Instead of $\delta$ 13C, you can call the axis delta 13C (per mil) (yes, lower-case). Graph modern $\delta$ 13C: [INSERT GRAPH, *don't worry if you get this warning, it's because one data point is absent fro the full dataset. ##Warning: Removed 1 rows containing missing values (geom_point)*] ```{r, graph modern delta 13C data} ggplot(ADD CORRECT DATA FRAME, aes(x= ,y= ))+ geom_point()+ labs(title = "ADD TITLE", x="ADD NAME", y= "ADD NAME") ``` **Answer the following:** b. We know that the $\delta$ 13C signature of fossil fuels is more negative than the current atmosphere. How does this data provide additional evidence that the rise in atmospheric CO2 is linked to fossil fuel emissions? # EXTRA: Modifying ggplot for slightly nicer default output ggplot2 has some default built-in themes that can easily be added to make the figures look nicer. Themes are added to a ggplot like all the other elements, with a `+`. These two are nice alternatives to the gray background, you can try them: * `+theme_bw()` * `+theme_linedraw()` ```{r, add theme to graph of modern delta 13C data} ggplot(modern.c13, aes(Year,C13_smooth))+ geom_point()+ labs(title = "Mauna Loa 13C Data", x="Year", y= "Atmospheric delta 13C")+ theme_bw() ```