rook.io package

Dataset input and output utilities.

class rook.io.DatasetFormat(value)[source]

Bases: Enum

Dataset formats supported by Rook.

KERCHUNK = 'kerchunk'
NETCDF = 'netcdf'
ZARR = 'zarr'
class rook.io.DatasetSource(dataset_id: str | None, paths: str | Path | Iterable[str | Path])[source]

Bases: object

A normalized set of paths and its optional catalog dataset id.

dataset_id: str | None
property key

Return the identifier used for operation result mappings.

paths: tuple[str, ...]
class rook.io.Transport(value)[source]

Bases: Enum

Transport protocols relevant to dataset opening.

FILESYSTEM = 'filesystem'
HTTP = 'http'
OTHER = 'other'
REFERENCE = 'reference'
S3 = 's3'
rook.io.open_dataset(source: DatasetSource, *, apply_fixes=True)[source]

Open an xarray Dataset and optionally apply rook-native fixes.

Submodules

rook.io.datasets module

Utilities for detecting and opening supported datasets.

class rook.io.datasets.DatasetFormat(value)[source]

Bases: Enum

Dataset formats supported by Rook.

KERCHUNK = 'kerchunk'
NETCDF = 'netcdf'
ZARR = 'zarr'
class rook.io.datasets.DatasetSource(dataset_id: str | None, paths: str | Path | Iterable[str | Path])[source]

Bases: object

A normalized set of paths and its optional catalog dataset id.

dataset_id: str | None
property key

Return the identifier used for operation result mappings.

paths: tuple[str, ...]
class rook.io.datasets.Transport(value)[source]

Bases: Enum

Transport protocols relevant to dataset opening.

FILESYSTEM = 'filesystem'
HTTP = 'http'
OTHER = 'other'
REFERENCE = 'reference'
S3 = 's3'
rook.io.datasets.detect_format(source: DatasetSource) DatasetFormat[source]

Detect the data format independently of its transport protocol.

rook.io.datasets.detect_transport(source: DatasetSource) Transport[source]

Detect and validate the transport shared by all source paths.

rook.io.datasets.get_storage_options(source: DatasetSource) dict[source]

Return transport options for a dataset source.

rook.io.datasets.is_kerchunk_file(dset)[source]

Return True when the input looks like a kerchunk reference file.

rook.io.datasets.is_zarr_store(dset)[source]

Return True when the input looks like a Zarr store path.

rook.io.datasets.open_dataset(source: DatasetSource, *, apply_fixes=True)[source]

Open an xarray Dataset and optionally apply rook-native fixes.

rook.io.datasets.open_kerchunk(source: DatasetSource, storage_options: dict)[source]

Open a single Kerchunk reference through the established clisops path.

rook.io.datasets.open_netcdf(source: DatasetSource, storage_options: dict)[source]

Open one or more NetCDF files through the established clisops opener.

rook.io.datasets.open_zarr(source: DatasetSource, storage_options: dict)[source]

Open a single Zarr store.