data_loader

climatebenchpress.data_loader

Modules:

  • canon
  • datasets
  • download
  • monitor

Functions:

open_downloaded_canonicalized_dataset

open_downloaded_canonicalized_dataset(
    cls: type[Dataset],
    basepath: Path = Path(),
    progress: bool = True,
) -> xr.Dataset

Download a given dataset and canonicalize it, i.e. ensure that all the axes names are consistent between different datasets.

Parameters:
  • cls (type[Dataset]) –

    The dataset class to download and open

  • basepath (Path, default: Path() ) –

    The base path where the dataset should be stored, by default Path()

  • progress (bool, default: True ) –

    Whether to show a progress bar during the download, by default True

Returns:
  • xr.Dataset

    The canonicalized dataset as an xarray Dataset

open_downloaded_tiny_canonicalized_dataset

open_downloaded_tiny_canonicalized_dataset(
    cls: type[Dataset],
    basepath: Path = Path(),
    progress: bool = True,
    slices: Optional[dict[str, slice]] = None,
) -> xr.Dataset

Same as open_downloaded_canonicalized_dataset, but returns a subset of the dataset.

These tiny datasets are mainly used for testing purposes.

Parameters:
  • cls (type[Dataset]) –

    The dataset class to download and open

  • basepath (Path, default: Path() ) –

    The base path where the dataset should be stored, by default Path()

  • progress (bool, default: True ) –

    Whether to show a progress bar during the download, by default True

  • slices (Optional[dict[str, slice]], default: None ) –

    A dictionary of slices to apply to the dataset, by default None

Returns:
  • xr.Dataset

    The canonicalized tiny dataset as an xarray Dataset