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.

Access CMIP6 zarr data from AWS using the osdf protocol and compute different precipitation statistics

Section 1: Introduction

  • Load python packkages

  • Load catalog url

/glade/derecho/scratch/harshah/tmp/ipykernel_37992/3451259092.py:6: TqdmExperimentalWarning: Using `tqdm.autonotebook.tqdm` in notebook mode. Use `tqdm.tqdm` instead to force console mode (e.g. in jupyter console)
  from tqdm.autonotebook import tqdm

Section 2: Select Dask Cluster

Select the Dask cluster type

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

If running on a HPC computer with a PBS Scheduler, set 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 logic for a Local Cluster

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

Loading...

Section 3: Data Loading

  • Load catalog and select data subset

Loading...
['esm-ssp585-ssp126Lu', 'ssp126-ssp370Lu', 'ssp370-ssp126Lu', 'ssp585', 'ssp245', 'ssp370-lowNTCF', 'ssp370SST-ssp126Lu', 'ssp370SST', 'ssp370pdSST', 'ssp370SST-lowCH4', 'ssp370SST-lowNTCF', 'ssp126', 'ssp119', 'ssp370', 'esm-ssp585', 'ssp245-nat', 'ssp245-GHG', 'ssp460', 'ssp434', 'ssp534-over', 'ssp245-aer', 'ssp245-stratO3', 'ssp245-cov-fossil', 'ssp245-cov-modgreen', 'ssp245-cov-strgreen', 'ssp245-covid', 'ssp585-bgc']
Loading...
Loading...
Loading...
array(['BCC-CSM2-MR', 'CNRM-CM6-1', 'CNRM-ESM2-1', 'IPSL-CM6A-LR'], dtype=object)
Loading...
<xarray.Dataset> Size: 13GB
Dimensions:    (lat: 160, bnds: 2, lon: 320, time: 61320)
Coordinates:
  * lat        (lat) float64 1kB -89.14 -88.03 -86.91 ... 86.91 88.03 89.14
    lat_bnds   (lat, bnds) float64 3kB dask.array<chunksize=(160, 2), meta=np.ndarray>
  * lon        (lon) float64 3kB 0.0 1.125 2.25 3.375 ... 356.6 357.8 358.9
    lon_bnds   (lon, bnds) float64 5kB dask.array<chunksize=(320, 2), meta=np.ndarray>
  * time       (time) object 491kB 1980-01-01 01:30:00 ... 2000-12-31 22:30:00
    time_bnds  (time, bnds) object 981kB dask.array<chunksize=(7300, 1), meta=np.ndarray>
Dimensions without coordinates: bnds
Data variables:
    pr         (time, lat, lon) float32 13GB dask.array<chunksize=(600, 160, 320), meta=np.ndarray>
Attributes: (12/52)
    Conventions:            CF-1.7 CMIP-6.2
    activity_id:            CMIP
    branch_method:          Standard
    branch_time_in_child:   0.0
    branch_time_in_parent:  2289.0
    cmor_version:           3.3.2
    ...                     ...
    tracking_id:            hdl:21.14100/822b921d-0abf-4bfb-b2dd-f0e7231c9185...
    variable_id:            pr
    variant_label:          r1i1p1f1
    status:                 2019-10-25;created;by nhn2@columbia.edu
    netcdf_tracking_ids:    hdl:21.14100/822b921d-0abf-4bfb-b2dd-f0e7231c9185...
    version_id:             v20190108
<xarray.Dataset> Size: 8GB
Dimensions:      (lat: 128, lon: 256, time: 61368, axis_nbounds: 2)
Coordinates:
  * lat          (lat) float64 1kB -88.93 -87.54 -86.14 ... 86.14 87.54 88.93
  * lon          (lon) float64 2kB 0.0 1.406 2.812 4.219 ... 355.8 357.2 358.6
  * time         (time) datetime64[ns] 491kB 1980-01-01T01:30:00 ... 2000-12-...
    time_bounds  (time, axis_nbounds) datetime64[ns] 982kB dask.array<chunksize=(42007, 1), meta=np.ndarray>
Dimensions without coordinates: axis_nbounds
Data variables:
    pr           (time, lat, lon) float32 8GB dask.array<chunksize=(552, 128, 256), meta=np.ndarray>
Attributes: (12/57)
    CMIP6_CV_version:       cv=6.2.3.0-7-g2019642
    Conventions:            CF-1.7 CMIP-6.2
    EXPID:                  CNRM-CM6-1_historical_r1i1p1f2
    NCO:                    "4.5.5"
    activity_id:            CMIP
    arpege_minor_version:   6.3.2
    ...                     ...
    variable_id:            pr
    variant_label:          r1i1p1f2
    xios_commit:            1442-shuffle
    status:                 2019-10-25;created;by nhn2@columbia.edu
    netcdf_tracking_ids:    hdl:21.14100/b9a171b4-af36-425a-9cc9-118e0aec726b...
    version_id:             v20180917
<xarray.Dataset> Size: 8GB
Dimensions:      (lat: 128, lon: 256, time: 61368, axis_nbounds: 2)
Coordinates:
  * lat          (lat) float64 1kB -88.93 -87.54 -86.14 ... 86.14 87.54 88.93
  * lon          (lon) float64 2kB 0.0 1.406 2.812 4.219 ... 355.8 357.2 358.6
  * time         (time) datetime64[ns] 491kB 1980-01-01T01:30:00 ... 2000-12-...
    time_bounds  (time, axis_nbounds) datetime64[ns] 982kB dask.array<chunksize=(42007, 1), meta=np.ndarray>
Dimensions without coordinates: axis_nbounds
Data variables:
    pr           (time, lat, lon) float32 8GB dask.array<chunksize=(552, 128, 256), meta=np.ndarray>
Attributes: (12/55)
    CMIP6_CV_version:       cv=6.2.3.0-7-g2019642
    Conventions:            CF-1.7 CMIP-6.2
    EXPID:                  CNRM-ESM2-1_historical_r1i1p1f2_v2
    activity_id:            CMIP
    arpege_minor_version:   6.3.2
    branch_method:          standard
    ...                     ...
    variable_id:            pr
    variant_label:          r1i1p1f2
    xios_commit:            1442-shuffle
    status:                 2019-10-25;created;by nhn2@columbia.edu
    netcdf_tracking_ids:    hdl:21.14100/f1e5c10f-c895-46b1-a771-05e33c7947b6...
    version_id:             v20181206
<xarray.Dataset> Size: 5GB
Dimensions:      (lat: 143, lon: 144, time: 61368, axis_nbounds: 2)
Coordinates:
  * lat          (lat) float32 572B -90.0 -88.73 -87.46 ... 87.46 88.73 90.0
  * lon          (lon) float32 576B 0.0 2.5 5.0 7.5 ... 350.0 352.5 355.0 357.5
  * time         (time) datetime64[ns] 491kB 1980-01-01T01:30:00 ... 2000-12-...
    time_bounds  (time, axis_nbounds) datetime64[ns] 982kB dask.array<chunksize=(42007, 1), meta=np.ndarray>
Dimensions without coordinates: axis_nbounds
Data variables:
    pr           (time, lat, lon) float32 5GB dask.array<chunksize=(316, 143, 144), meta=np.ndarray>
Attributes: (12/54)
    CMIP6_CV_version:       cv=6.2.3.5-2-g63b123e
    Conventions:            CF-1.7 CMIP-6.2
    EXPID:                  historical
    NCO:                    "4.6.0"
    activity_id:            CMIP
    branch_method:          standard
    ...                     ...
    tracking_id:            hdl:21.14100/6032861a-7350-45ff-aac7-0dfa54c100d7...
    variable_id:            pr
    variant_label:          r4i1p1f1
    status:                 2019-11-05;created;by nhn2@columbia.edu
    netcdf_tracking_ids:    hdl:21.14100/6032861a-7350-45ff-aac7-0dfa54c100d7...
    version_id:             v20180803
CPU times: user 36.2 s, sys: 1.51 s, total: 37.7 s
Wall time: 10min 25s

Section 4: Data Analysis

  • Calculate precipitation statistics

  • Grab some observations ?

  • Plot precipitation changes for different CMIP6 models

CPU times: user 161 ms, sys: 9.99 ms, total: 171 ms
Wall time: 177 ms
<Figure size 640x480 with 2 Axes>
<Figure size 640x480 with 2 Axes>
<Figure size 640x480 with 2 Axes>
<Figure size 640x480 with 2 Axes>