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.

Calculate surface ocean heat content using CESM2 LENS data

Table of Contents

Section 1: Introduction

Input Data Access

  • This notebook illustrates how to compute surface ocean heat content using potential temperature data from CESM2 Large Ensemble Dataset (https://www.cesm.ucar.edu/community-projects/lens2) hosted on NCAR’s GDEX.

  • This data is open access and is accessed via OSDF

/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.

/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 43825 instead
  warnings.warn(
Loading...

Section 3: Data Loading

Loading...
Loading...
<ArrowExtensionArray> ['osdf:///ncar-gdex/d010092/ocn/monthly/cesm2LE-historical-cmip6-TEMP.zarr'] Length: 1, dtype: large_string[pyarrow]

--> The keys in the returned dictionary of datasets are constructed as follows:
	'component.experiment.frequency.forcing_variant'
Loading...
Loading...
['ocn.historical.monthly.cmip6']
Loading...

Change units

Unit('centimeters')
Loading...
Loading...
Loading...
Loading...

Section 4: Data Analysis

Compute Ocean Heat content for ocean surface

  • Ocean surface is considered to be the top 100m

  • The formula for this is:

    H=ρC∫0zT(z)dzH = \rho C \int_0^z T(z) dz

Where H is ocean heat content, the value we are trying to calculate,

ρ\rho is the density of sea water, 1026kg/m31026 kg/m^3 ,

CC is the specific heat of sea water, 3990J/(kgK)3990 J/(kg K) ,

zz is the depth limit of the calculation in meters,

and T(z)T(z) is the temperature at each depth in degrees Kelvin.

Loading...
Loading...
Loading...

Plot Ocean Heat

CPU times: user 39.6 ms, sys: 3.67 ms, total: 43.3 ms
Wall time: 42.9 ms
Loading...
/glade/u/home/harshah/.conda/envs/osdf/lib/python3.11/site-packages/distributed/client.py:3375: UserWarning: Sending large graph of size 14.27 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(
CPU times: user 11.5 s, sys: 687 ms, total: 12.2 s
Wall time: 1min 30s
<Figure size 640x480 with 2 Axes>
CPU times: user 11.5 s, sys: 455 ms, total: 12 s
Wall time: 1min 3s
<Figure size 640x480 with 2 Axes>

Has the surface ocean heat content increased with time for January ? (Due to Global Warming!)

/glade/u/home/harshah/.conda/envs/osdf/lib/python3.11/site-packages/distributed/client.py:3375: UserWarning: Sending large graph of size 14.27 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(
CPU times: user 10.9 s, sys: 344 ms, total: 11.2 s
Wall time: 1min 1s
<Figure size 640x480 with 2 Axes>