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
(orbasid
in case ofkind='basin'
) must be provided.- Parameters:
ds (
xarray.Dataset
) – dataset containing basin and flow direction variablesbasin_index (
geopandas.GeoDataFrame
orGeoDataFrameAdapter
) – Dataframe with basin geomtries or bounding boxes with “basid” column corresponding to theds[<basins_name>]
map.kind (
{"basin", "subbasin", "interbasin"}
) – kind of basin descriptionbounds (
array_like
offloat
, 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
offloat
, optional) – [xmin, ymin, xmax, ymax] coordinates to infer (sub)(inter)basin(s)geom (
geopandas.GeoDataFrame
, optional) – polygon geometry describing area of interestxy (
tuple
ofarray_like
offloat
, optional) – x, y coordinates of (sub)basin outlet locationsbasid (
int
orarray_like
ofint
, optional) – basin IDs, must match values in basin mapsoutlets (
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 valuebuffer – 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