hydromt.data_catalog.DataCatalog.get_geodataset#

DataCatalog.get_geodataset(data_like: str | SourceSpecDict | Path | Dataset | DataArray, bbox: List | None = None, geom: GeoDataFrame | None = None, buffer: float | int = 0, handle_nodata: NoDataStrategy = NoDataStrategy.RAISE, predicate: str = 'intersects', variables: List | None = None, 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 GeoDataset.

To clip the data to the area of interest, provide a bbox or geom, with optional additional buffer and align arguments. 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 Dataset.

Parameters:
  • data_like (str, Path, xr.Dataset, xr.DataArray) – 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.

  • bbox (array-like of floats) – (xmin, ymin, xmax, ymax) bounding box of area of interest (in WGS84 coordinates).

  • geom (geopandas.GeoDataFrame/Series,) – A geometry defining the area of interest.

  • buffer (float, optional) – Buffer around the bbox or geom area of interest in meters. By default 0.

  • handle_nodata (NoDataStrategy Optional) – what should happen if the requested data set is empty. RAISE by default

  • predicate (optional) – If predicate is provided, the GeoDataFrame is filtered by testing the predicate function against each item. Requires bbox or mask. By default ‘intersects’ options are: {‘intersects’, ‘within’, ‘contains’, ‘overlaps’, ‘crosses’, ‘touches’},

  • variables (str or list of str, optional.) – Names of GeoDataset variables to return. By default all dataset variables are returned.

  • 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 GeoDatasetAdapter function. Only used if data_like is a path to a geodataset file.

Returns:

obj – GeoDataset

Return type:

xarray.Dataset or xarray.DataArray