hydromt.data_catalog.DataCatalog.get_rasterdataset#

DataCatalog.get_rasterdataset(path_or_key: str, bbox: Optional[List] = None, geom: Optional[GeoDataFrame] = None, zoom_level: Optional[Union[int, tuple]] = None, buffer: Union[float, int] = 0, align: Optional[bool] = None, variables: Optional[Union[List, str]] = None, time_tuple: Optional[Tuple] = None, single_var_as_array: bool = True, **kwargs) Dataset[source]#

Returns a clipped, sliced and unified RasterDataset from the data catalog.

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 and check their presence, 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 xarray.Dataset.

Parameters:
  • path_or_key (str) – Data catalog key. If a path to a raster file is provided it will be added to the data_catalog with its based on the file basename without extension.

  • 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.

  • zoom_level (int, tuple, optional) – Zoom level of the xyz tile dataset (0 is base level) Using a tuple the zoom level can be specified as (<zoom_resolution>, <unit>), e.g., (1000, ‘meter’)

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

  • align (float, optional) – Resolution to align the bounding box, by default None

  • variables (str or list of str, optional.) – Names of RasterDataset 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.

Returns:

obj – RasterDataset

Return type:

xarray.Dataset or xarray.DataArray