hydromt.workflows.basin_mask.get_basin_geometry#

hydromt.workflows.basin_mask.get_basin_geometry(ds, basin_index=None, kind='basin', bounds=None, bbox=None, geom=None, xy=None, basid=None, outlets=False, basins_name='basins', flwdir_name='flwdir', ftype='infer', logger=<Logger hydromt.workflows.basin_mask (WARNING)>, buffer=10, **stream_kwargs)[source]#

Return a geometry of the (sub)(inter)basin(s).

This method derives a geometry of sub-, inter- or full basin based on an input dataset with flow-direction and optional basins ID raster data in combination with a matching basin geometry file containing the bounding boxes of each basin.

Either bbox, geom, xy (or basid in case of kind='basin') must be provided.

Parameters:
  • ds (xarray.Dataset) – dataset containing basin and flow direction variables

  • basin_index (geopandas.GeoDataFrame or GeoDataFrameAdapter) – Dataframe with basin geomtries or bounding boxes with “basid” column corresponding to the ds[<basins_name>] map.

  • kind ({"basin", "subbasin", "interbasin"}) – kind of basin description

  • bounds (array_like of float, optional) – [xmin, ymin, xmax, ymax] coordinates of total bounding box, i.e. the data is clipped to this domain before futher processing.

  • bbox (array_like of float, optional) – [xmin, ymin, xmax, ymax] coordinates to infer (sub)(inter)basin(s)

  • geom (geopandas.GeoDataFrame, optional) – polygon geometry describing area of interest

  • xy (tuple of array_like of float, optional) – x, y coordinates of (sub)basin outlet locations

  • basid (int or array_like of int, optional) – basin IDs, must match values in basin maps

  • outlets (bool, optional) – If True, include (sub)basins of outlets within domain only.

  • flwdir_name (str, optional) – Name of flow direction variable in source, by default “flwdir”

  • basins_name (str, optional) – Name of flow direction variable in source, by default “basins”

  • ftype ({'d8', 'ldd', 'nextxy'}, optional) – name of flow direction type, by default None; use input ftype.

  • stream_kwargs (key-word arguments) – name of variable in ds and threshold value

  • buffer – The buffer to apply.

  • logger – The logger to use.

Returns:

  • basin_geom (geopandas.geoDataFrame) – geometry the (sub)basin(s)

  • outlet_geom (geopandas.geoDataFrame) – geometry the outlet point location