Skip to content

carbonplan/cmip6-downscaling

Repository files navigation

CarbonPlan monogram.

carbonplan / cmip6-downscaling

climate downscaling using cmip6 data

CI PyPI License: MIT

This repository includes our tools/scripts/models/etc for climate downscaling. This work is described in more detail in a web article with a companion map tool to explore the data. We encourage you to reach out if you are interested in using the code or datasets by opening an issue or sending us an email.

development

Requires pixi. Clone the repo, then:

pixi install -e dev
pixi run -e dev pytest tests

data access

There are three ways to access the data using Python.

First, the entire collection of datasets at daily timescales is available through an intake catalog using the following code snippet.

# /// script
# dependencies = [
#   "xarray",
#   "aiohttp",
#   "intake-esm",
#   "dask",
# ]
# ///
#
import intake
cat = intake.open_esm_datastore(
  'https://rice1.osn.mghpcc.org/carbonplan/cp-cmip/version1/catalog/osn-rechunked-global-downscaled-cmip6.json'
)

You can check out this example Jupyter notebook to see how to access the data, perform some simple analysis, and download subsets.

You can also access the data by using the URL of an individual dataset. See the datasets page for a table of all available datasets in this collection with storage locations and other metadata. A code snippet showing how to use the URL is shown below:

import xarray as xr
xr.open_zarr('https://rice1.osn.mghpcc.org/carbonplan/cp-cmip/version1/data/DeepSD/ScenarioMIP.CCCma.CanESM5.ssp245.r1i1p1f1.day.DeepSD.pr.zarr',chunks={})

The datasets are also available as Icechunk stores, which use zarr v3 sharding for efficient cloud-native access. These stores are anonymously readable and can be opened with xarray as follows:

import icechunk
import xarray as xr

storage = icechunk.s3_storage(
    bucket="carbonplan",
    prefix="cp-cmip/version1/icechunk_data/DeepSD/ScenarioMIP.CCCma.CanESM5.ssp245.r1i1p1f1.day.DeepSD.pr.zarr",
    endpoint_url="https://rice1.osn.mghpcc.org",
    force_path_style=True,
    anonymous=True,
)
repo = icechunk.Repository.open(storage)
session = repo.readonly_session("main")
ds = xr.open_zarr(session.store, chunks={})

The prefix follows the pattern cp-cmip/version1/icechunk_data/{method}/{store_name} where method and store_name match the values in the intake catalog.

license

All the code in this repository is MIT-licensed. Some of the data provided by this API is sourced from content made available under a CC-BY-4.0 license. We include attribution for this content, and we please request that you also maintain that attribution if using this data.

about us

CarbonPlan is a nonprofit organization that uses data and science for climate action. We aim to improve the transparency and scientific integrity of climate solutions with open data and tools. Find out more at carbonplan.org or get in touch by opening an issue or sending us an email.

About

Climate downscaling using CMIP6 data

Resources

License

Code of conduct

Contributing

Security policy

Stars

211 stars

Watchers

12 watching

Forks

Sponsor this project

  •  

Packages

 
 
 

Contributors