hydromt.data_catalog.drivers.GeoDatasetDriver#
- pydantic model hydromt.data_catalog.drivers.GeoDatasetDriver[source]#
Abstract Driver to read GeoDatasets.
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.
- field options: GeoDatasetOptions [Optional]#
Driver options that can be used to configure the behavior of the driver. DriverOptions allows for setting arbitrary kwargs. Any options not explicitly declared in the DriverOptions class are passed as kwargs to the underlying open functions.
- abstract read(uris: list[str], *, handle_nodata: NoDataStrategy = NoDataStrategy.RAISE, mask: GeoDataFrame | GeoSeries | None = None, predicate: Literal['intersects', 'within', 'contains', 'overlaps', 'crosses', 'touches'] = 'intersects', metadata: SourceMetadata | None = None) Dataset[source]#
Read in data to an xarray Dataset.
- Parameters:
uris (
list[str]) – List of URIs to read data from.handle_nodata (
NoDataStrategy, optional) – Strategy to handle missing data. Default is NoDataStrategy.RAISE.mask (
Geom | None, optional) – Optional spatial mask to clip the dataset.predicate (
Predicate, optional) – Spatial predicate for filtering geometries. Default is “intersects”.metadata (
SourceMetadata | None, optional) – Optional metadata object to attach to the loaded dataset.
- Returns:
The dataset read from the source, or None if no data found and strategy allows.
- Return type:
xr.Dataset | None
- abstract write(path: Path | str, data: Dataset, *, write_kwargs: dict[str, Any] | None = None) Path[source]#
Write a GeoDataset to disk.
- Parameters:
path (
Path | str) – Destination path or URI where the dataset will be written. The path should have a supported extension depending on the concrete driver implementation.data (
xr.Dataset) – The xarray Dataset to write.write_kwargs (
dict[str,Any] | None, optional) – Additional keyword arguments to pass to the underlying write function. These may include encoding options for NetCDF, or mode/format options for Zarr. Default is None.
- Returns:
The path where the dataset was written.
- Return type:
Path