hydromt.data_catalog.drivers.RasterDatasetDriver#
- pydantic model hydromt.data_catalog.drivers.RasterDatasetDriver[source]#
Abstract Driver to read GeoDataFrames.
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, mask: GeoDataFrame | GeoSeries | None = None, variables: str | List[str] | None = None, zoom: int | Tuple[float, str] | None = None, chunks: dict[str, Any] | None = None, metadata: SourceMetadata | None = None) Dataset[source]#
Read raster data from one or more URIs into an xarray Dataset.
This abstract method defines the common interface for raster-based drivers. Implementations must return an xarray Dataset representing the loaded raster data.
- Parameters:
uris (
list[str]) – List of file URIs to read from.handle_nodata (
NoDataStrategy, optional) – Strategy for handling missing or empty data. Default is NoDataStrategy.RAISE.mask (
Geom | None, optional) – Optional geometry to spatially mask or clip the data. Default is None.variables (
Variables | None, optional) – List of variable names or bands to read from the dataset. Default is None.zoom (
Zoom | None, optional) – Optional zoom level or resolution control for multi-resolution raster data. Default is None.chunks (
dict[str,Any] | None, optional) – Chunking configuration for Dask-based reading. Default is None.metadata (
SourceMetadata | None, optional) – Metadata about the source such as CRS, nodata values, and zoom levels. Default is None.
- Returns:
The loaded raster dataset.
- Return type:
xr.Dataset
- abstract write(path: Path | str, data: Dataset, *, write_kwargs: dict[str, Any] | None = None) Path[source]#
Write a RasterDataset to a local file.
- Parameters:
path (
Path | str) – Destination path or URI where the raster dataset will be written. The path should have a supported extension depending on the concrete driver implementation.data (
xr.Dataset) – The xarray Dataset representing the raster data to write.write_kwargs (
dict[str,Any] | None, optional) – Additional keyword arguments to pass to the underlying write function. Default is None.
- Returns:
The path to the written raster dataset.
- Return type:
Path