Intake ESM is an experimental new package that aims to provide a higher-level interface to searching and loading Earth System Model data archives, such as CMIP6. The packages is under very active development, and features may be unstable. Please report any issues or suggestions on github.
import xarray as xr
xr.set_options(display_style='html')
import intake
%matplotlib inline
Intake ESM works by parsing an ESM Collection Spec and converting it to an intake catalog. The collection spec is stored in a .json file. Here we open it using intake.
cat_url = "https://storage.googleapis.com/cmip6/pangeo-cmip6.json"
col = intake.open_esm_datastore(cat_url)
col
We can now use intake methods to search the collection, and, if desired, export a pandas dataframe.
cat = col.search(experiment_id=['historical', 'ssp585'], table_id='Oyr', variable_id='o2',
grid_label='gn')
cat.df
Intake knows how to automatically open the datasets using xarray. Furthermore, intake esm contains special logic to concatenate and merge the individual results of our query into larger, more high-level aggregated xarray datasets.
dset_dict = cat.to_dataset_dict(zarr_kwargs={'consolidated': True})
list(dset_dict.keys())
ds = dset_dict['CMIP.CCCma.CanESM5.historical.Oyr.gn']
ds