hydromt.data_catalog.DataCatalog.get_dataset#

DataCatalog.get_dataset(data_like: str | SourceSpecDict | Path | Dataset | DataArray, variables: List | None = None, handle_nodata: NoDataStrategy = NoDataStrategy.RAISE, time_tuple: Tuple[str, str] | Tuple[datetime, datetime] | None = None, single_var_as_array: bool = True, provider: str | None = None, version: str | None = None, **kwargs) Dataset[source]#

Return a clipped, sliced and unified Dataset.

To slice the data to the time period of interest, provide the time_tuple argument. To return only the dataset variables of interest provide the variables argument.

NOTE: Unless single_var_as_array is set to False a single-variable data source will be returned as xarray.DataArray rather than a xarray.Dataset.

Parameters:
  • data_like (str, Path, xr.Dataset, xr.DataArray, SourceSpecDict) – Data catalog key, path to geodataset file or geodataset xarray object. The catalog key can be a string or a dictionary with the following keys: {‘name’, ‘provider’, ‘version’}. If a path to a file is provided it will be added to the catalog with its based on the file basename.

  • time_tuple (tuple of str, datetime, optional) – Start and end date of period of interest. By default the entire time period of the dataset is returned.

  • single_var_as_array (bool, optional) – If True, return a DataArray if the dataset consists of a single variable. If False, always return a Dataset. By default True.

  • **kwargs – Additional keyword arguments that are passed to the DatasetAdapter function. Only used if data_like is a path to a geodataset file.

Returns:

obj – Dataset

Return type:

xarray.Dataset or xarray.DataArray