hydromt.data_catalog.sources.RasterDatasetSource.detect_time_range#

RasterDatasetSource.detect_time_range(ds: Dataset | None = None) Annotated[Tuple[datetime, datetime], BeforeValidator(func=_time_range_from_str, json_schema_input_type=PydanticUndefined), AfterValidator(func=_time_range_validate)][source]#

Detect the temporal range of the dataset.

If no dataset is provided, it will be fetched accodring to the settings in the addapter. also see hydromt.RasterdatasetAdapter.get_data().

Parameters:

ds (xr.Dataset, xr.DataArray, Optional) – the dataset to detect the time range of. It must have a time dimentsion set. If none is provided, hydromt.RasterdatasetAdapter.get_data() will be used to fetch the it before detecting.

Returns:

range – A tuple containing the start and end of the time dimension. Range is inclusive on both sides.

Return type:

Tuple[np.datetime64, np.datetime64]