input.catalog#

Classes

ValenspyEsmDatastore(*args, **kwargs)

Subclass of intake_esm.ESMDataStore for ValEnsPy.

class ValenspyEsmDatastore(*args, **kwargs)[source]#

Subclass of intake_esm.ESMDataStore for ValEnsPy.

This extends the ESMDataStore class with a adittional search functionality for time based searching using the time_period column.

search(require_all_on: str | list[str] | None = None, **query)[source]#

Search for entries in the catalog.

Standard search function of the intake_esm.esm_datastore class extended with time based searching based on the time_period column.

Parameters:
  • require_all_on (str, optional) – A dataframe column or a list of dataframe columns across which all entries must satisfy the query criteria. If None, return entries that fulfill any of the criteria specified in the query, by default None.

  • **query – keyword arguments corresponding to user’s query to execute against the dataframe.

See also

intake_esm.esm_datastore.search

to_datatree(levels: list[str] = None, **kwargs)[source]#

Load catalog entries into a tree of xarray datasets.

Parameters:
  • xarray_open_kwargs (dict) – Keyword arguments to pass to open_dataset function

  • xarray_combine_by_coords_kwargs (: dict) – Keyword arguments to pass to combine_by_coords function.

  • preprocess (callable, optional) – If provided, call this function on each dataset prior to aggregation.

  • storage_options (dict, optional) – Parameters passed to the backend file-system such as Google Cloud Storage, Amazon Web Service S3.

  • progressbar (bool) – If True, will print a progress bar to standard error (stderr) when loading assets into Dataset.

  • aggregate (bool, optional) – If False, no aggregation will be done.

  • skip_on_error (bool, optional) – If True, skip datasets that cannot be loaded and/or variables we are unable to derive.

  • levels (list[str], optional) – List of fields to use as the datatree nodes. WARNING: This will overwrite the fields used to create the unique aggregation keys.

Returns:

dsets – A tree of xarray Dataset.

Return type:

DataTree

Examples

>>> import intake
>>> cat = intake.open_esm_datastore('glade-cmip6.json')
>>> sub_cat = cat.search(
...     source_id=['BCC-CSM2-MR', 'CNRM-CM6-1', 'CNRM-ESM2-1'],
...     experiment_id=['historical', 'ssp585'],
...     variable_id='pr',
...     table_id='Amon',
...     grid_label='gn',
... )
>>> dsets = sub_cat.to_datatree()
>>> dsets['CMIP/BCC.BCC-CSM2-MR/historical/Amon/gn'].ds
<xarray.Dataset>
Dimensions:    (bnds: 2, lat: 160, lon: 320, member_id: 3, time: 1980)
Coordinates:
* lon        (lon) float64 0.0 1.125 2.25 3.375 ... 355.5 356.6 357.8 358.9
* lat        (lat) float64 -89.14 -88.03 -86.91 -85.79 ... 86.91 88.03 89.14
* time       (time) object 1850-01-16 12:00:00 ... 2014-12-16 12:00:00
* member_id  (member_id) <U8 'r1i1p1f1' 'r2i1p1f1' 'r3i1p1f1'
Dimensions without coordinates: bnds
Data variables:
    lat_bnds   (lat, bnds) float64 dask.array<chunksize=(160, 2), meta=np.ndarray>
    lon_bnds   (lon, bnds) float64 dask.array<chunksize=(320, 2), meta=np.ndarray>
    time_bnds  (time, bnds) object dask.array<chunksize=(1980, 2), meta=np.ndarray>
    pr         (member_id, time, lat, lon) float32 dask.array<chunksize=(1, 600, 160, 320), meta=np.ndarray>