| title: ‘Homework #2’ |
| author: “Sam Stein” |
| date: “2025-02-18” |
| output: |
| html_document: default |
| pdf_document: default |
install.packages(“rlang”) install.packages(“tidyr”) library(tidyverse)
install.packages(“ggplot2”)
remove.packages(“S7”) install.packages(“S7”)
install.packages(“tinytex”) library(tinytex) tinytex::install_tinytex()
This homework is designed for someone with a basic understanding of R and RStudio. If you have never used RStudio before (or don’t remember foundational skills like importing data, using functions, or creating graphs), you should work through the RStudio practice problems posted to Canvas/the syllabus. I have also linked a tutorial on Canvas from ENV 101 that includes a video showing how to open and run files in RStudio.
Once you feel like you have a grasp of basic RStudio skills, you can proceed. We will not be reading in any additional data or .csv files for this particular homework. After this introduction, each section below (marked with the ## or ### and a section title) contains the plain text and code chunks needed to answer each homework question. Some questions will not require any code to answer.
By default, this document is designed to export as an HTML file. When you “knit” this document as an HTML file (see the “Knit” button with the ball of yarn above), it will launch a pop-up window with the finished document. You can use the “open in browser” link to open this page in your default web browser, and then print the document to a PDF.
You can also knit this document to PDF file directly by selecting the drop down arrow to the right of the Knit button and selecting “Knit to PDF”. The first time you knit to PDF on your computer, your computer may prompt you to install some additional packages; if you agree to install those additional packages RStudio should be able to create a PDF of your file.
If you still are encountering issues, your computer may require an additional software package to help translate the format of this document into a PDF. Any software package that helps programs understand LaTeX formatting will work. If you don’t already have a preferred program (or you have no idea what I’m talking about), download MiKTeX from this link: https://miktex.org/download
I suggest trying the “Knit to PDF” option once before you dive into the homework to test if it works for your computer. If it doesn’t, you can decide if you’d like to try installing MiKTeX or just knitting to an HTML and printing the file to a PDF from there. If you encounter technical issues with downloading the file, come to office hours or send me an email with a screenshot of any error messages you’re seeing.
We discussed the Clausius-Clapeyron relationship in class, and examined a chart that told us how much water vapor can be held in the air at a given temperature. We will be using R to recreate the underlying equations from this chart in more depth and apply these equations to actual air parcels.
Use the Clausius-Clapeyron equation to determine the vapor pressure of the maximum amount of water that can be held in the air above Mongolia in the summer vs winter months.
#Let's create a new function that will solve the Clausius-Clapeyron equation for us
#I've created the function that will solve the equation; you will just need to use the correct inputs
#First we'll define some constants to use in our equation
#You can run everything from this point to the line that says "#CC_eqn(put_correct_Temp_here)" as it (but read them before you run them)
#This is the gas constant for water vapor (in units of Jkg^-1K^-1)
R_v <- 461.5
#This is the latent heat of vaporization (in units of Jkg^-1)
l_v <- 2.26e6
#This is just setting up a baseline temperature of 273 K (or 0 degC)
T_0 <- 273
#This is an approximation of the vapor pressure of water at T_0 (in units of hPa)
e_s0 <- 6.11
#Now we can define the function, which we'll call CC_eqn. This equation will be a function of temperature (so that's the only input needed when we use this function later)
#Note: the exp() you see below is just a way of writing e^()
CC_eqn <- function(Temp){ #Naming the function and setting the inputs
e_s0*exp(l_v/(R_v*T_0))*exp(-l_v/(R_v*Temp)) #Defining the eqn that we are solving for
}
#The answer returned by this eqn is e_s, the equilibrium saturated vapor pressure, in units of hPa (hectoPascals)
#Now when we use the CC_eqn, it will tell us how much water vapor can be held in an air parcel (in terms of hPa) given the temp of the air parcel (in K)
#Recall that to go from deg C to K, we just need to add 273
CC_eqn(300) #this gives vapor pressure at 300K
## [1] 30.70259
#Test out our equation below. At 0 deg C, you should get an answer of around 6.11 hPa
CC_eqn(297.5)
## [1] 26.76711
To answer for Question 1.1:
What is the saturated vapor pressure at the average summer temperature in Mongolia (24.5 degC)? How does this compare to the saturated vapor pressure at Mongolia’s average winter temperature (-25.9 degC)?
The saturated vapor pressure at the average summer temperature in Mongolia (24.5 °C) is 26.76 hPa. The saturated vapor pressure at the average winter temperature in Mongolia (-25.9 °C) is 0.932 hPa. The summer vapor pressure is significantly higher than the winter vapor pressure.
What implications does this have for Mongolia’s weather/climate in the winter compared to the summer? Hint: there’s obviously a temperature difference, but your answer should address more than just temperature.
The summer has a much higher vapor pressure because temperatures are higher, allowing the air to hold much more water vapor. This is proven with the Clausius-Clapeyron relationship because it says that the maximum water vapor that the air can hold increases exponentially when the temperature rises. When there is more water vapor in the air, humidity is much higher, meaning the summer in Magnolia is much moister and could have more rain than in the winter. In the winter, with less vapor pressure, the air will be drier, and there will be fewer rainstorms.
Now that we have a function defined, we can use it to evaluate multiple values at once. Use the function to recreate the classic Clausius-Clapeyron relationship graph we examined in class. The first code chunk will demonstrate how to do this; you will use the second code chunk to create your graph.
Now’s it’s your turn. Use the code chunk below to recreate the graph. Use the code from the previous chunk to help you.
To submit for Q1.2: the Clausius-Clapeyron Relationship Graph (should generate automatically from your code chunk below once you create your graph)
#Create your set of input temperatures in the space below. Most CC charts include about 250-310 K, so make sure your graph includes 250-310 K in it.
sampleTemp <- 250:310
#Now use your input temperatures to solve for the corresponding e_s (equilibrium saturated vapor pressure) #Reminder: you're using the CC_eqn function we created above
graphVapPress <- CC_eqn(sampleTemp)
graphData <- cbind(sampleTemp, sampleVapPress)
## Warning in cbind(sampleTemp, sampleVapPress): number of rows of result is not a
## multiple of vector length (arg 2)
#Finally, create a line graph using this data. Make sure your graph has appropriate axis labels with units
#I've copied the example graph from the previous code chunk to help you get started. Adjust this accordingly- you will need to change this code to create your graph
ggplot(sampleData) +
geom_line(aes(x=sampleTemp, y=sampleVapPress)) +
theme_minimal() + #uses a preset style for the graph
xlab("Temperature (K)") + #Sets the x axis label
ylab("Vapor Pressure (hPa)") #Sets the Y axis label
The equation we used in Q1.1 and 1.2 gives us the equilibrium saturated vapor pressure (e_s)- in other words, it tells us how much pressure the maximum amount of water vapor could exert on the air parcel at a given temperature. In some cases, we might want to know the saturated specific humidity (q*), which tells us the maximum mass of water that can be held in a given mass of air based on it’s temperature.
This can be helpful if we want to know the relative humidity of a given air parcel. You might be familiar with this term; it means the mass of water found in an air parcel compared to the maximum mass of water that could be held in that same air parcel. Air with a higher relative humidity is “wetter” air, in that it holds a higher % of the water that it could physically hold.
The e_s and q* are directly related to each other and both values are based on the Clausius-Clapeyron relationship, but since they use different units we need to take slightly different approaches to calculate them. We will write a new equation to find q* based on e_s and air pressure, and then use this equation to answer the next few questions.
## [1] 3.739283
## [1] 12.72198
Now that the equation is defined, you can use it answer the following:
To answer for Question 1.3:
If a 1kg parcel of air is fully saturated and has a temperature of 20 degC, approximately what mass of water vapor does it hold (in units of g)? You can assume that this parcel is at typical MSL air pressure.
The Parcel holds 12.722 grams
Now we’ll use these equations to determine the relative humidity of the air parcel you analyzed in Question 1.3. The equation for relative humidity is q/q* x 100%. In this equation, q* is the saturated specific humidity that we calculated above, and q is the specific humidity, or the amount of water actually present in the air parcel (not the theoretical maximum). The units for both q and q* are g of water/kg of air.
Assume that this same 1kg parcel of air from Question 1.3 warmed to 30 degC. You can also assume that the pressure has remained constant and that the mass of water vapor contained in the parcel has not changed. What is the relative humidity of this parcel now that it has warmed up to 30 degC?
Hint: you’ll need both the saturated specific humidity at the new temp AND the saturated specific humidity at the old temp to answer this question.
## [1] 22.08577
## [1] 57.60258
To answer for Question 1.4:
What is the relative humidity of the air parcel after it warmed to 30 degC (in units of %)?
57.60%
Consider our 1kg air parcel from Question 1.3, the parcel that was fully saturated at 20 degC. Suppose that this parcel cooled to 10 degC. The Clausius-Clapeyron relationship tells us that cooler air cannot hold as much water vapor as warm air. How much water will condense from our fully saturated 20 degC parcel as it cools to 10 degC?
## [1] 7.048011
## [1] 5.673964
To answer for Question 1.5:
How much water condensed from the 1kg parcel as it cooled from 20 degC to 10 degC? Report your answer in units of g.
5.67 grams of water
Now that you’re familiar with calculating data about the amount of water in the atmosphere, let’s consider how this can impact global-scale atmospheric processes.
Consider a simple system with two components: water in the atmosphere, and Earth’s temperature. If we were to create a feedback loop from these two components, would that feedback loop be positive or negative? What implications does your answer have for anthropogenic (human-driven) climate change?
To answer for Question 2.1:
Evaluate if the feedback loop is positive or negative, and how that feedback loop relates to climate change. There is no R code associated with this question; you can embed an image if you want, but answering in text is totally fine.
This feedback loop would be positive because the warmer the atmosphere, the more water vapor it can hold. As climate change worsens due to increased greenhouse gases, temperatures will rise, and the atmosphere will be able to hold more water vapor. Greenhouse gases will keep on rising due to human pollution meaning the temperature will rise and the amount of water vapor in the atmosphere will rise too.
As we discussed in class, moist convection is driven in part by the release of latent heat. The same amount of energy needed to evaporate 1 kg of liquid water into water vapor will be released as heat when that 1 kg of water vapor condenses back into liquid form. The latent heat of vaporization of water is 2.26 x 10^6 J/kg for water at 100 degC. See slides from Lecture 7 for more details on latent heat.
Consider a 1 kg parcel of air found along the equator, which we will call parcel A. As parcel A travels across the ocean, 15 g of water condenses from the parcel. How much energy (in J) is released into parcel A as a result of this condensation?
You can calculate your answer using the code chunk below. Pay attention to your units.
## [1] 33900
To answer for Question 2.2:
Estimate how much heat (in J) was released into parcel A after 15 g of water condensed into liquid water from water vapor.
33,900 J
We will use the website Windy to answer the final few questions. Navigate to https://www.windy.com. Zoom out to the farthest extent possible (look for the + and - signs in the bottom right corner or scroll with your mouse). Change the layer being displayed from the default (wind) to temperature. If temperature doesn’t appear as an option on the list on the right hand side of the screen, you can click the Menu button in the top right and see the complete list of all possible layers.
What you are seeing is a real time (or close to real time) look at global surface temperature. Which latitudes tend to have the highest temperature? If needed, you can turn on the grid lines showing latitude and longitude by going to Menu > Settings > Show lat, lon grid.
To answer for Question 2.3:
Which latitudes tend to have the highest temperature? There is no R code associated with this question.
The highest temperature latitude is 0 with a temperature of 79 degF.
Now change the layer to display Pressure. Adjust the scale to read hPa (you can change the units by clicking on the scale bar). Approximately what pressure is the region that you indicated in Question 2.3? Note that this answer doesn’t need to be exact, and most latitudes will have a range of values. You may find it helpful to click a few points in the region and average the values you see for your answer. Give your answer in hPa.
To answer for Question 2.4:
What is the approximate pressure in the region you answered for Question 2.3 (in hPa)? There is no R code associated with this question.
The approximate pressure in latitude 0 is 1,007 hPa
Consider the approximate pressure off the coast of Southern California and off the coast of Ecuador. In which direction (North, East, Southwest, etc) is the pressure gradient force acting between SoCal and Ecuador?
To answer for Question 2.5:
In which direction is the pressure gradient force acting in this region? There is no R code associated with this question.
The pressure gradient force acts in the southward direction because California has a pressure of 1,016 hPa, while Ecuador has a pressure of 1,008 hPa.
Now consider the impact of the Coriolis force in this area. After accounting for the Coriolis effect, in what direction would you primarily expect the wind to blow in the region between SoCal and Ecuador? (North, south, southwest, etc).
To answer for Question 2.6:
In what direction would you primarily expect the wind to blow in this region? There is no R code associated with this question.
I would expect it to go southwest because California is in the Northern Hemisphere, and winds tend to veer down and to the right.
Finally, let’s put your answers to the previous questions together. Consider the Clausius-Clapeyron relationship, the latent heat of vaporization, and the process of moist convection. In a few sentences or a short paragraph, explain how moist convection leads to the wind pattern that you discussed in Question 2.6.
To answer for Question 2.7:
How does moist convection create the regional wind pattern you described in Question 2.6? This can be answered in a few sentences or a short paragraph. There is no R code associated with this question.
Moist convection creates the regional wind pattern when it releases latent heat during condensation. When this process occurs, it makes the warm air rise and expand, holding a lot of water vapor until it releases it again, repeating the process over and over. This pulls wind from regions around it, creating the regional wind pattern.
Once you’ve answered all of the above questions, your homework is complete. You can knit it and upload the PDF to Gradescope when you’re satisfied with your answers. Double check that the PDF is displaying all of your answers as intended (especially the graph from Question 1).