{ "cells": [ { "cell_type": "markdown", "id": "8be352fc-1d78-4e9a-a476-c4ce9957ef7a", "metadata": {}, "source": [ "# Downloading global CMIP data\n", "This notebook demonstrates how to download global CMIP6 files based on your criteria (variables, models, experiments, etc.). This notebook only walks through the process of downloading the raw CMIP6 files, not formatting them for ELM [funcationality does not yet exist].\n", "\n", "`dapper` uses a Pangeo-hosted CMIP repository, as we found that ESGF was kinda tricky because of the transience and availability of nodes. The Pangeo archive standardizes everything into a quickly-searchable and downloadable archive, but it is not a perfect mirror of all the available data across ESGF. If you're not finding what you need here, you may have to look in ESGF. Note that Google Earth Engine also hosts a downscaled set of CMIP6 models/variables, but unfortunately it includes only a limited set of variables--not everything needed for ELM runs, so we do not provide functionality for sampling it.\n", "\n", "Searching and downloading from the Pangeo archive does not require an account, so unlike ERA5-Land data that needs a Google Earth Engine account, this should work straight out of the box." ] }, { "cell_type": "markdown", "id": "01f9cb80", "metadata": {}, "source": [ "Similar to working with ERA5-Land Hourly data, here we will specify a `params` dictionary and then send our request. Let's look at these `params` a little bit here.\n", "\n", "| Key | Definition | Examples |\n", "|--------------|------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------|\n", "| `models` | Climate models (or \"sources\") that produced the simulation data, each with unique physics, resolution, and configurations. | `CESM2`, `IPSL-CM6A-LR`, `CanESM5`, `MPI-ESM1-2-HR` |\n", "| `variables` | Climate variables simulated by the models, including atmospheric, oceanic, and land-surface data. | `pr`, `tas`, `psl`, `ua` |\n", "| `experiment` | Predefined scenarios that specify forcing conditions used in climate simulations. | `historical`, `ssp245`, `ssp370`, `ssp585`, `piControl` |\n", "| `table` | Frequency and domain of the model output data. | `Amon`, `day`, `Omon`, `Lmon` |\n", "| `ensemble` | Identifier specifying realization, initialization, physics, and forcing configurations for the model run. | `r1i1p1f1`, `r2i1p1f1`, `r1i2p1f2` |\n", "\n", "You do not need to specify all of these. For example, if you're not sure which models you want, just leave it out and you'll be returned with all the models that match your other criteria. Let's try it out." ] }, { "cell_type": "code", "execution_count": null, "id": "e53bb136", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " activity_id institution_id source_id experiment_id \\\n", "0 CMIP NOAA-GFDL GFDL-CM4 historical \n", "1 CMIP NOAA-GFDL GFDL-CM4 historical \n", "2 CMIP IPSL IPSL-CM6A-LR historical \n", "3 CMIP IPSL IPSL-CM6A-LR historical \n", "4 CMIP NASA-GISS GISS-E2-1-G historical \n", ".. ... ... ... ... \n", "103 CMIP IPSL IPSL-CM6A-LR-INCA historical \n", "104 CMIP KIOST KIOST-ESM historical \n", "105 CMIP KIOST KIOST-ESM historical \n", "106 CMIP EC-Earth-Consortium EC-Earth3-Veg historical \n", "107 CMIP EC-Earth-Consortium EC-Earth3-Veg historical \n", "\n", " member_id table_id variable_id grid_label \\\n", "0 r1i1p1f1 Amon pr gr1 \n", "1 r1i1p1f1 Amon tas gr1 \n", "2 r1i1p1f1 Amon pr gr \n", "3 r1i1p1f1 Amon tas gr \n", "4 r1i1p1f1 Amon tas gn \n", ".. ... ... ... ... \n", "103 r1i1p1f1 Amon tas gr \n", "104 r1i1p1f1 Amon tas gr1 \n", "105 r1i1p1f1 Amon pr gr1 \n", "106 r1i1p1f1 Amon pr gr \n", "107 r1i1p1f1 Amon tas gr \n", "\n", " zstore dcpp_init_year \\\n", "0 gs://cmip6/CMIP6/CMIP/NOAA-GFDL/GFDL-CM4/histo... NaN \n", "1 gs://cmip6/CMIP6/CMIP/NOAA-GFDL/GFDL-CM4/histo... NaN \n", "2 gs://cmip6/CMIP6/CMIP/IPSL/IPSL-CM6A-LR/histor... NaN \n", "3 gs://cmip6/CMIP6/CMIP/IPSL/IPSL-CM6A-LR/histor... NaN \n", "4 gs://cmip6/CMIP6/CMIP/NASA-GISS/GISS-E2-1-G/hi... NaN \n", ".. ... ... \n", "103 gs://cmip6/CMIP6/CMIP/IPSL/IPSL-CM6A-LR-INCA/h... NaN \n", "104 gs://cmip6/CMIP6/CMIP/KIOST/KIOST-ESM/historic... NaN \n", "105 gs://cmip6/CMIP6/CMIP/KIOST/KIOST-ESM/historic... NaN \n", "106 gs://cmip6/CMIP6/CMIP/EC-Earth-Consortium/EC-E... NaN \n", "107 gs://cmip6/CMIP6/CMIP/EC-Earth-Consortium/EC-E... NaN \n", "\n", " version \n", "0 20180701 \n", "1 20180701 \n", "2 20180803 \n", "3 20180803 \n", "4 20180827 \n", ".. ... \n", "103 20210216 \n", "104 20210601 \n", "105 20210928 \n", "106 20211207 \n", "107 20211207 \n", "\n", "[108 rows x 11 columns]\n" ] } ], "source": [ "from pathlib import Path\n", "from dapper.met import cmip_utils as cu\n", "\n", "# We will leave model selections out for now\n", "params = {\n", " \"variables\": [\"pr\", \"tas\"],\n", " \"experiment\": \"historical\",\n", " \"table\": [\"Amon\"],\n", " \"ensemble\": \"r1i1p1f1\",\n", "}\n", "\n", "available = cu.find_available_data(params)\n", "\n", "print(available)\n" ] }, { "cell_type": "markdown", "id": "c08d80a0", "metadata": {}, "source": [ "Now we see a table where each row corresponds to a dataset. Note that each variable will be on its own row, even if it comes from the same model, table, experiment, and ensemble. Let's say that you only want 10 samples of both `pr` and `tas` instead of the full catalog. We will do this by specifying the `Index` of `available.df` for the rows we want to keep. Here, we'll find 5 of these indexes.\n", "\n", "