hydromt.gis.flw.basin_map#
- hydromt.gis.flw.basin_map(ds: Dataset, flwdir: FlwdirRaster, *, xy: Tuple | None = None, idxs: ndarray | None = None, outlets: bool = False, ids: ndarray | None = None, stream: DataArray | None = None, **stream_kwargs) DataArray | Tuple [source]#
Return a (sub)basin map, with unique non-zero IDs for each subbasin.
- Parameters:
ds (
xarray.Dataset
) – Dataset used for output grid definition and containing stream_kwargs variables.flwdir (
pyflwdir.FlwdirRaster
) – Flow direction raster objectidxs (
1D array
orint
, optional) – linear indices of sub(basin) outlets, by default is None.xy (
tuple
of1D array
offloat
, optional) – x, y coordinates of sub(basin) outlets, by default is None.outlets (
bool
, optional) – If True and xy and idxs are None, the basin map is derived for basin outlets only, excluding pits at the edge of the domain of incomplete basins.ids (
1D array
ofint32
, optional) – IDs of (sub)basins, must be larger than zero, by default Nonestream (
2D array
ofbool
, optional) – Mask of stream cells used to snap outlets to, by default Nonestream_kwargs (
dict
, optional) – Parameter-treshold pairs to define streams. Multiple threshold will be combined using a logical_and operation. If a stream if provided, it is combined with the threshhold based map as well.
- Returns:
da_basin (
xarray.DataArray
ofint32
) – basin ID mapxy (
tuple
ofarray_like
offloat
) – snapped x, y coordinates of sub(basin) outlets
See also