hydromt.model.processes.basin_mask.get_basin_geometry#

hydromt.model.processes.basin_mask.get_basin_geometry(ds: Dataset, basin_index: GeoDataFrame = None, kind: str = 'basin', bounds: list[float] | tuple[float] | None = None, bbox: list[float] | tuple[float] | None = None, geom: GeoDataFrame | None = None, xy: list[float] | tuple[float] | None = None, basid: int | list[int] | None = None, outlets: bool = False, basins_name: str = 'basins', flwdir_name: str = 'flwdir', ftype: str = 'infer', buffer: int = 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 (xr.Dataset) – Dataset containing basin and flow direction variables

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

  • kind (str) – Kind of basin description, choose from “basin”, “subbasin” or “interbasin”

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

  • bbox (list[float] | tuple[float], optional) – [xmin, ymin, xmax, ymax] coordinates to infer (sub)(inter)basin(s), by default None

  • geom (gpd.GeoDataFrame, optional) – Polygon geometry describing area of interest

  • xy (list[float] | tuple[float], optional) – x, y coordinates of (sub)basin outlet locations, by default None

  • basid (int | list[int], optional) – Basin IDs, must match values in basin maps, by default None

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

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

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

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

  • buffer (int, optional) – The buffer to apply, by default 10

  • **stream_kwargs (dict) – Name of variable in ds and threshold value

Returns:

Geometry of the (sub)basin(s) and geometry of the outlet point location

Return type:

tuple[gpd.GeoDataFrame]