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.

CESM2 LENS Global Mean Surface Temperature anomaly

Access CESM2 LENS data from NCAR’s Geoscience Data Exchange (GDEX) and compute GMST

Table of Contents

Section 1: Introduction

  • Python package imports and useful function definitions

/glade/derecho/scratch/harshah

Section 2: Select Dask Cluster

  • Setting up a dask cluster. You will need to choose the type of cluster based on your use case.

  • The default will be LocalCluster as that can run on any system.

  • If running on NCAR’s HPC i.e, Casper with a PBS Scheduler, set USE_PBS_SCHEDULER to True. Otherwise, set to False.

If running on Jupyter server with Dask Gateway configured, set to True. Otherwise, set to False.

Python function for a PBS cluster

Python function for a Gateway Cluster

Python function for a Local Cluster

Python logic to select the Dask Cluster type

  • This uses True/False boolean logic based on the variables set in the previous cells

/glade/u/home/harshah/.conda/envs/osdf/lib/python3.11/site-packages/distributed/node.py:188: UserWarning: Port 8787 is already in use.
Perhaps you already have a cluster running?
Hosting the HTTP server on port 34263 instead
  warnings.warn(
Loading...

Section 3: Data Loading

Loading...
Loading...
<ArrowExtensionArray> ['osdf:///ncar-gdex/d010092/atm/monthly/cesm2LE-historical-cmip6-TREFHT.zarr', 'osdf:///ncar-gdex/d010092/atm/monthly/cesm2LE-historical-smbb-TREFHT.zarr', 'osdf:///ncar-gdex/d010092/atm/monthly/cesm2LE-ssp370-cmip6-TREFHT.zarr', 'osdf:///ncar-gdex/d010092/atm/monthly/cesm2LE-ssp370-smbb-TREFHT.zarr'] Length: 4, dtype: large_string[pyarrow]

--> The keys in the returned dictionary of datasets are constructed as follows:
	'component.experiment.frequency.forcing_variant'
Loading...
Loading...
dict_keys(['atm.ssp370.monthly.cmip6', 'atm.ssp370.monthly.smbb', 'atm.historical.monthly.smbb', 'atm.historical.monthly.cmip6'])
Loading...

Make a quick plot to check data transfer

CPU times: user 98.5 ms, sys: 18.1 ms, total: 117 ms
Wall time: 615 ms
<Figure size 640x480 with 2 Axes>

Section 4: Data Analysis

  • Perform the Global Mean Surface Temperature computation

Merge datasets and compute Global Mean surrface temperature anomaly

  • Warning! This section takes about a min to run!

  • Config: 3 dask workers with 8GiB memory.

Loading...

Compute (spatially weighted) Global Mean

Loading...
CPU times: user 6.52 ms, sys: 263 μs, total: 6.79 ms
Wall time: 6.64 ms
Loading...

Compute anomaly and plot

Loading...
CPU times: user 7.62 ms, sys: 3.78 ms, total: 11.4 ms
Wall time: 10.9 ms
<Figure size 640x480 with 1 Axes>