hydromt.data_catalog.drivers.DatasetDriver#
- pydantic model hydromt.data_catalog.drivers.DatasetDriver[source]#
Abstract Driver to read Datasets.
Create a new model by parsing and validating input data from keyword arguments.
Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.
self is explicitly positional-only to allow self as a field name.
- abstract read(uris: list[str], *, handle_nodata: NoDataStrategy = NoDataStrategy.RAISE) Dataset[source]#
Read data from one or more URIs into an xarray Dataset.
This abstract method defines the interface for all dataset drivers. Subclasses should implement data loading logic appropriate for the format being read.
- Parameters:
uris (
list[str]) – List of URIs to read data from.handle_nodata (
NoDataStrategy, optional) – Strategy to handle missing or empty data. Default is NoDataStrategy.RAISE.
- Returns:
The loaded dataset.
- Return type:
xr.Dataset
- abstract write(path: Path | str, data: Dataset, *, write_kwargs: dict[str, Any] | None = None) Path[source]#
Write an xarray Dataset to disk.
This abstract method defines the interface for all Dataset-based drivers. Subclasses should implement logic for writing datasets in specific formats (e.g., NetCDF, Zarr).
- Parameters:
path (
Path | str) – Destination path or URI where the Dataset should be written.data (
xr.Dataset) – The Dataset to write.write_kwargs (
dict[str,Any], optional) – Additional keyword arguments to pass to the underlying xarray write function (e.g., to_zarr, to_netcdf). Default is None.
- Returns:
The path where the data was written.
- Return type:
Path