hydromt.data_catalog.adapters.RasterDatasetAdapter.transform#
- RasterDatasetAdapter.transform(ds: Dataset, metadata: SourceMetadata, *, mask: GeoDataFrame | GeoSeries | None = None, align: bool | None = None, variables: str | List[str] | None = None, time_range: Annotated[Tuple[datetime, datetime], BeforeValidator(func=_time_range_from_str), AfterValidator(func=_time_range_validate)] | None = None, handle_nodata: NoDataStrategy = NoDataStrategy.RAISE, single_var_as_array: bool = True) Dataset | DataArray | None [source]#
Filter and harmonize the input RasterDataset.
- Parameters:
ds (
xr.Dataset
) – input RasterDatasetmetadata (
SourceMetadata
) – source metadatamask (
Optional[gpd.GeoDataFrame]
, optional) – mask to filter by geometry, by default Nonevariables (
Optional[List[str]]
, optional) – variable filter, by default Nonetime_range (
Optional[TimeRange]
, optional) – filter start and end times, by default Nonehandle_nodata (
NoDataStrategy
, optional) – how to handle no data being present in the result, by default NoDataStrategy.RAISEsingle_var_as_array (
bool
, optional) – whether to return a xr.DataArray if only a single variable is present, by default True
- Returns:
The filtered and harmonized RasterDataset, or None if no data was available
- Return type:
Optional[xr.Dataset]
- Raises:
ValueError – if not all variables are found in the data
NoDataException – if no data in left after slicing and handle_nodata is NoDataStrategy.RAISE