Part 4 - Global warming levels (i)

Prepared by Mathias Hauser.

In the fourth part we will be working with global warming levels (GWLs). In Part 3 we compared two models for the same time period, here we will compare them at the same GWL and see that they are much closer to each other. A GWL is defined as the first 20-year period where the global-mean annual-mean surface air temperature exceeds the targeted warming level (e.g. +1.5°C, +2.0°C, etc.) relative to 1850 to 1900.

Learning goals

  • programming goals

    • look at a function written by someone else

    • using new functions and methods, e.g. xarray’s rolling operation

  • scientific and data analyis goals

    • understand how the differences in TXx between the warmest and coldest model become much smaller when correcting for the global mean temperature

Preparation

Create a new notebook with the name p4_warming_levels_name.ipynb - don’t forget the title and your name!

Note

For students if the ip python course: please submit the finished notebook on the second hand in date.

Read global mean temperature

  1. Open the netCDF with annual mean global mean temperatures - "../data/cmip6/tas/tas_annmean_globmean.nc" you saved in Part 2 (“Convert to a Dastaset”).

    Warning

    This requires that you already completed Part 2.

  2. Compute anomalies w.r.t. 1850 - 1900 and select the variable tas.

Test warming level period function

In this section we will look at a function to get the warming level period. We will illustrate this for a GWL of +2.0°C for a single model.

Select model

  1. Select a single model from the tas data, tas_one = tas.sel(...).

Show Tglob and warming level

First we want to illustrate what we are looking for:

  1. Create a plot that shows the tas data of the model that you selected above.

  2. Mark the 0°C temperature anomaly with a horizontal line using ax.axhline(0, color="0.1").

  3. Also mark the desired GWL at +2.0°C.

    Note

    This is not the correct definition of a GWL yet as it is defined as:

    A GWL is defined as the first 20-year period where the global-mean annual-mean surface air temperature exceeds the targeted warming level (e.g. +1.5°C, 2.0°C, etc.) relative to 1850 to 1900.

    Therefore we also have to plot a 20-year running mean.

  4. To plot a running 20-year mean we can make use of the method rolling and add it to the plot.

    # calculate 20-year rolling mean
    tas_one_20y = tas_one.rolling(year=20, center=True).mean()
    tas_one_20y.plot(ax=ax)
    

This illustrates what we are doing in the next section. We need to find the year where the 20-year rolling mean temperature crosses +2.0°C (or to be more precise we need to find the 20-year period around this year).

Compute warming level period

  1. A function to calculate the GWL period is provided in computation.warming_level_period. To test the function pass the tas data of the selected model and 2.0 as warming level. What does the function return?

    It returns a slice object that can be used to select time periods from xarray objects.

  2. Use the returned slice object to check if the correct GWL period was returned: compute the mean over the years and ensure the result is >= 2.0 (i.e. the passed warming_level).

  3. Open computation.py and look at the code of the warming_level_period function. Alternatively execute computation.warming_level_period?? (with two question marks) in a code cell - this also shows the source code of the function.

  4. Try to understand what the code does. Some tips:

    • Read through the code and the comments

    • Copy the code line-by-line to a code cell and look at the result.

    • Plot the result of the result.

    • Check the documentation.

  5. What happens if you pass warming_level=-1 to the function? Does this result make sense?

  6. Optional: Change the code of the warming_level_period function so it raises a ValueError if the warming level is smaller or equal 0. You can model this after the error check that is already in the function.

    • You will need to re-load computation or restart the kernel to test it.

Illustrate warming level period

We can now update the figure from above to include the determined 20-year period.

  1. Copy the plotting code from above.

  2. Add the following code to show the GWL period.

    ax.axvspan(period.start, period.stop, color="0.75")
    

    where period is the value returned from warming_level_period.

Compare spatial pattern at warming level

We will now go back to the gridded TXx temperatures we considered in the last part. We will again compare the change in TXx for the models that warmed the least and the most. However, this time we will not look at this for the same time period but compare them such that the global mean temperature of the models are the same - i.e. at a global warming levels.

Preparation: Loading the TXx data

  1. Open the files of the model that warmed the most and the least over 20 years (copy the code from Part 3).

  2. Calculate anomalies w.r.t. 1850-1900 using computation.calc_anomaly(...) for both models.

Computing warming level periods

We now calculate the GWL periods for the two models

  1. Calculate the warming_level_period from the global mean temperature of the two models.

  2. How do they compare?

    You should get two very different 20-year periods - as expected by the different global mean warming of the two models.

  3. Optional: create a plot with the tas of the two models and illustrate the GWL periods.

  4. Select the warming_level_period from the grided TXx data and compute the mean over time.

Plotting the data

  1. Prepare a map plot with two subplots. Choose a projection of your liking. Add coastlines.

    • You can copy-paste the plot from the end of Part 2.

  2. Add the mean temperature change over the years of the warming level period of the two models.

    • Make sure you update all the necessary things (plotted data and labels).

Update the plot

  1. Many of the arguments passed to the plot functions are the same for the two models - we can avoid this duplication by definig a dictionary of options (we will take a closer look at dictionaries in Part 5). Thus instead of

    ax = axs[0]
    data1.plot(ax=ax, add_colorbar=False, transform=ccrs.PlateCarree())
    ax = axs[1]
    data2.plot(ax=ax, add_colorbar=False, transform=ccrs.PlateCarree())
    

    you can use:

    opt = dict(add_colorbar=False, transform=ccrs.PlateCarree())
    ax = axs[0]
    data1.plot(ax=ax, **opt)
    ax = axs[1]
    data2.plot(ax=ax, **opt)
    
  2. Make sure the two variables show the same color scale. Add a colorbar.

  3. Add a the name of the model as title.

  4. Use f.suptitle to describe what variable is shown and the warming level.

  5. Optional: Use cartopy to mask out the ocean (in white) and only show data over land (see e.g. this feature example in the cartopy docs).

    • You will have to pass the zorder and facecolor arguments. The ocean feature should be drawn above the data but below the coastlines.

  6. How do the temperature anomalies compare?

What have you learned so far?

Comparing the two map plots here should show a TXx signal that is not fundamentally different between the two models. Yes, they show local differences, e.g. CanESM5 warms more in South America, while INM-CM5-0 shows more warming over Europe. However, the overall magnitude of the anomalies is small, especially, when comparing them to the differences between the models obtained in part 2. This highlights why GWLs can be a good idea to compare local changes for models with very different global mean temperature warming.

This concludes Part 4.