Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Reproducing Key Figures from Kay et al. (2015)


Overview

This notebook demonstrates how one might use the NCAR Community Earth System Model (CESM) Large Ensemble (LENS) data hosted on AWS S3. The notebook shows how to reproduce figures 2 and 4 from the Kay et al. (2015) paper describing the CESM LENS dataset Kay et al., 2015.

This resource is intended to be helpful for people not familiar with elements of the Pangeo framework including Jupyter Notebooks, Xarray, and Zarr data format, or with the original paper, so it includes additional explanation.

Prerequisites

ConceptsImportanceNotes
Intro to XarrayNecessary
DaskHelpful
  • Time to learn: 30 minutes


Imports

<dask.config.set at 0x7f57a63534d0>

Create and Connect to Dask Distributed Cluster

Here we’ll use a dask cluster to parallelize our analysis.

Loading...

Load and Prepare Data

Loading...

Show the first few lines of the catalog:

Loading...

Show expanded version of collection structure with details:

Loading...

Extract data needed to construct Figure 2

Search the catalog to find the desired data, in this case the reference height temperature of the atmosphere, at monthly time resolution, for the Historical, 20th Century, and RCP8.5 (IPCC Representative Concentration Pathway 8.5) experiments. Monthly resolution is sufficient here since Figures 2 and 4 only ever use annual or seasonal means, and using it instead of daily data cuts the volume read from S3 by roughly a factor of 30.

Loading...
Loading...

Load catalog entries for subset into a dictionary of Xarray Datasets:


--> The keys in the returned dictionary of datasets are constructed as follows:
	'component.experiment.frequency'
Loading...
Loading...

Dataset dictionary keys:
 dict_keys(['atm.20C.monthly', 'atm.RCP85.monthly', 'atm.HIST.monthly'])

Define Xarray Datasets corresponding to the three experiments:

Use the dask.distributed utility function to display size of each dataset:

Historical: 177.21 MiB
20th Century: 8.50 GiB
RCP8.5: 9.39 GiB

Now, extract the Reference Height Temperature data variable:

Loading...

The global surface temperature anomaly is computed relative to the 1961-90 base period in the Kay et al. paper. Rather than extracting that time slice up front, we’ll derive its mean later directly from the full 20th Century series once it’s loaded, which avoids reading those same years from S3 twice.

Figure 2

Read grid cell areas

Cell size varies with latitude, so this must be accounted for when computing the global mean.


--> The keys in the returned dictionary of datasets are constructed as follows:
	'variable.long_name.component.experiment.frequency.vertical_levels.spatial_domain.units.start_time.end_time.path'
Loading...
Loading...
Loading...

Define weighted means

Note: resample(time="YS") does an annual resampling based on start of calendar year. See documentation for Pandas resampling options.

Read data and compute means

Dask’s “lazy execution” philosophy means that until this point we have not actually read the bulk of the data. Steps 1 and 4 take a while to complete, so we include the Notebook “cell magic” directive %%time to display elapsed and CPU times after computation. The reference-period mean needed for the anomaly calculation is derived directly from the Step 1 result, so it doesn’t require an extra read of the data.

Step 1 (takes a while): load the full 20th Century series

CPU times: user 13.8 s, sys: 1.37 s, total: 15.2 s
Wall time: 53.4 s
Loading...

Step 2 (executes quickly): Compute the 1961-90 reference-period mean from the full time series

Derive the 1961-90 reference-period mean directly from the 20th Century series we just loaded, rather than re-reading those same years from S3 a second time:

CPU times: user 1.7 ms, sys: 0 ns, total: 1.7 ms
Wall time: 1.64 ms
Loading...

Step 3 (executes quickly): convert pre-loaded historical data to a pandas series

CPU times: user 383 ms, sys: 43.8 ms, total: 427 ms
Wall time: 2.4 s
time 1850-01-01 00:00:00 286.205444 1851-01-01 00:00:00 286.273590 1852-01-01 00:00:00 286.247986 1853-01-01 00:00:00 286.240692 1854-01-01 00:00:00 286.150696 dtype: float32

Step 4 (takes a while): Do the same thing for the RCP8.5 scenario data

CPU times: user 14.6 s, sys: 1.14 s, total: 15.8 s
Wall time: 57.2 s
Loading...

Get observations for Figure 2 (HadCRUT4)

The HadCRUT4 temperature dataset is described by Morice et al. (2012).

Observational time series data for comparison with ensemble average:

ERR: curl error: Stream error in the HTTP/2 framing layer
ERR: DAP DATADDS packet is apparently too short
Loading...

Limit observations to 20th century:

time 1920-01-01 0.0 1921-01-01 0.0 1922-01-01 0.0 1923-01-01 0.0 1924-01-01 0.0 Freq: YS-JAN, dtype: float64

Combine ensemble member 1 data from historical and 20th century experiments:

Plotting Figure 2

Global surface temperature anomaly (1961-90 base period) for individual ensemble members, and observations:

<Figure size 640x480 with 1 Axes>

Figure 4

Compute linear trend for winter seasons

CPU times: user 9.82 s, sys: 1.72 s, total: 11.5 s
Wall time: 46.5 s
/home/runner/micromamba/envs/cla-cookbook-dev/lib/python3.14/site-packages/distributed/client.py:3429: UserWarning: Sending large graph of size 286.89 MiB.
This may cause some slowdown.
Consider loading the data with Dask directly
 or using futures or delayed objects to embed the data into the graph without repetition.
See also https://docs.dask.org/en/stable/best-practices.html#load-data-with-dask for more information.
  warnings.warn(

Make sure that we have 34 seasons:

Get observations for Figure 4 (NASA GISS GisTemp)

This is observational time series data for comparison with ensemble average. Here we are using the GISS Surface Temperature Analysis (GISTEMP v4) from NASA’s Goddard Institute of Space Studies Lenssen et al., 2019.

Define the URL to Project Pythia’s Jetstream2 Object Store and the path to the Zarr file.

Loading...

Create an Xarray Dataset from the Zarr object

Remap longitude range from [-180, 180] to [0, 360] for plotting purposes:

Loading...

Include only full seasons from 1979 through 2012:

Loading...

And compute observed winter trends:

Loading...

Plotting Figure 4

Global maps of historical (1979 - 2012) boreal winter (DJF) surface air trends:

CPU times: user 1min 13s, sys: 2 s, total: 1min 15s
Wall time: 1min 12s
/home/runner/micromamba/envs/cla-cookbook-dev/lib/python3.14/site-packages/cartopy/io/__init__.py:263: DownloadWarning: Downloading: https://naturalearth.s3.amazonaws.com/110m_physical/ne_110m_coastline.zip
  warnings.warn(f'Downloading: {url}', DownloadWarning)
<Figure size 1710x1950 with 65 Axes>

Close our client:


Summary

In this notebook, we used CESM LENS data hosted on AWS to recreate two key figures in the paper that describes the project.

What’s next?

More example workflows using these datasets may be added in the future.

References
  1. Kay, J. E., Deser, C., Phillips, A., Mai, A., Hannay, C., Strand, G., Arblaster, J. M., Bates, S. C., Danabasoglu, G., Edwards, J., Holland, M., Kushner, P., Lamarque, J.-F., Lawrence, D., Lindsday, K., Middleton, A., Munoz, E., Neale, R., Oleson, K., … Vertenstein, M. (2015). The Community Earth System Model (CESM) Large Ensemble Project. Bull. Amer. Meteor. Soc. 10.1175/BAMS-D-13-00255.1
  2. Morice, C. P., Kennedy, J. J., Rayner, N. A., & Jones, P. D. (2012). Quantifying uncertainties in global and regional temperature change using an ensemble of observational estimates: The HadCRUT4 data set. J. Geophys. Res. Atmos., 117(D8). 10.1029/2011JD017187
  3. Lenssen, N., Schmidt, G., Hansen, J., Menne, M., Persin, A., Ruedy, R., & Zyss, D. (2019). Improvements in the GISTEMP uncertainty model. Journal of Geophysical Research: Atmospheres, 124(12), 6307–6326. 10.1029/2018JD029522