Number of freezing days lost to global warming (data analytics demo)

We are going to estimate the impact of global warming at your location using a simple cosine function and some climate data. Scientists estimate that there has been a global shift in the average temperature of about 1.4 Farenheit. This may not seem like a big change, but we will see how this shift affects the number of freezing days (<32 F) each year.

The data below is shown for Columbus but you should be able to easily adapt this for your location by following the directions and modifying the program.

Step 1. Go to google and type "climate data [name of your city]"

To look up the typical high and low temperatures throughout the year for your location, go to google and type "climate data [name of your city]" into the search bar. This will automatically give you climate data for your location.

Click "Graphs" to see how the high & low temperature varies through the year

If you were curious where this data comes from, google obtained it through the NOAA website.

Step 2. Calculate the average temperature of the coldest and hottest month

We need to estimate the average temperature on the coldest and warmest day of the year. The easiest way to do this is to take an average of the high & low temperature in January and July. In the following we will use the numbers for Columbus, but you should use the numbers for your location: $$ T_{\rm coldest} = \frac{T_{\rm jan, high} + T_{\rm jan, low}}{2} = \frac{36 \, F + 21 \, F \rm }{2} = 28.5 \, {\rm F} $$ $$ T_{\rm warmest} = \frac{T_{\rm july, high} + T_{\rm july, low}}{2} = \frac{85 \, F + 65 \, F \rm }{2} = 75.0 \, {\rm F} $$

Go ahead and calculate what these numbers would be for your location. The above is just an example.

Step 3. Open up the code in the editor

Click here to open up the code in the editor (works best in chrome)

Here is a link if you just want to run the program

Go ahead and look at the code to see the different parts. Notice that each time we run the draw function, the global temperature increases by a small amount.

Advice: don't forget to click the little gray down arrow next to where it says "Clear" to show the whole code.

Step 4. Modify the beginning of the code to use the numbers you determined in Step 2

Modify this part of the code to have the appropriate values for your location:

Step 5. Run the code and notice how many freezing days have been lost as the temperature shift increases

Run the code and notice how many freezing (T < 32 F) days are lost as the temperature shift increases. The horizontal black line in the graph on the bottom right represents 10 days lost! Pay close attention to how many freezing days are lost when the temperature shift reaches 1.4 F, which is the global average value. What percentage of the initial number of days of freezing weather does this represent? How significant of an impact on lakes and snowfall (and snowmen!) do you think this would have?

Note: if you live close to the equator and don't have any days with an average temperature below freezing, how would you estimate the impact? Can you modify the code to estimate how many days of T < 50 F weather that you would lose?

Step 6. Temperature variability

Our model for the temperature thus far looks like this: $$T(t) = -A \cos \left(\frac{2 \pi}{T} \cdot t \right) + T_{\rm ave} $$

In the code, this equation looks like this:

   Temperature[i] = -A*cos(2*PI/Year*t) + Tave;

As we all know, the temperature can be very different from day to day. In the midwest, it is not uncommon for the temperature to swing up or down by as much as 10 degrees Farenheit from day to day. Let's add some variability to our model and see what the effect is on the number of days with freezing weather.

So take this code:

   Temperature[i] = -A*cos(2*PI/Year*t) + Tave;

And add to it a random function:

   Temperature[i] = -A*cos(2*PI/Year*t) + Tave + random(-10,10);

Now see what happens! Your code should behave something like this Watch the code run and confirm that you still lose a significant number of days of freezing as the global temperature increases.

Step 7. Download the data and open in a spreadsheet

It would be interesting to download the temperature data for when the shift in temperature is equal to some value, say, when Twarming is equal to 1.4 Farenheit which is the current estimate for the overall increase in average temperature.

You can do this by adding this code AFTER the for loop:

   if (Twarming.toFixed(2) ==  1.4) {       
        saveData(table,'daily_temperatures.csv');
   } // end if
  

Open up the data in your favorite spreadsheet program (examples: google sheets, excel, libreoffice, Apple numbers). What is the hottest temperature? Change 1.4 to 0 and see how the hottest temperature has changed. Compare to real data from www.timeanddate.com/weather

Challenge: Improve the model!

There are a couple of ways that we can improve the model. Here are some ideas:

1. Make sure the coldest day of the year is mid-January

If you look closely at the simulation, you will notice that it places the coldest day of the year at January 1st. If you do a search on your location at www.accuweather.com and you click "Month" and then select January, you will see that according to the historical average, the coldest day of the year is in mid-January, not the beginning of January. Can you modify the code to take this into account? (Hint: this is just a shift in the time variable).

2. Modify the code to put your city in the southern hemisphere

When it is winter in the Northern hemisphere, it is summer in the southern hemisphere. (If you don't believe it, go to a grocery store in the middle of January and think about how the bananas got there.) Can you modify the code so that it is as if your city is located in the southern hemisphere? (Hint: you only need to modify one line of code to do this).

3. Look closely at weather data for your location and make a more realistic assumption for random(-10,10)

If the place where you live is close to a body of water, the temperature may not vary as much as we assumed earlier with our random(-10,10) function. It might be closer to random(-5,5), for example. Look closely at weather data from www.accuweather.com and make a better guess at the parameters of the random function to represent your city.

4. Compare to published estimates for the impact of climate change at your location

It's possible that scientists have already assessed the impact of climate change at your location. Here is a link to reports for over a dozen cities in the wider Great Lakes region

If you click on the little blue pin and scroll down to the pdf you can find documents like this one for Columbus, Ohio.

Interestingly, some cities saw a temperature increase of more than 1.4 F, and some saw less. Columbus actually saw an increase of 2.3 F, and they estimate that there was 25.5 fewer days of freezing weather as a result (starting from 99.6 days of freezing weather). How well does this match the estimate from the program with a temperature shift of 2.3 F?

If you live outside the Great Lakes region you may be able to find some useful info here How many fewer days of freezing weather does the model predict for your location based on the temperature increase measured from 2017 (second hottest year on record)?

Finished!