pyflwdir.FlwdirRaster.basins#

FlwdirRaster.basins(idxs=None, xy=None, ids=None, **kwargs)[source]#

Returns a (sub)basin map with a unique ID for every (sub)basin.

To return a subbasin map either linear indices or x,y coordinates of subbasin outlets should be provided. Additional key-word arguments are passed to the snap method to snap the outlets to a downstream stream.

By default, if IDs are not provided (sub)basin IDs start from 1. As the the background value of the basins map is zero, the IDs may not contain zeros.

Parameters:
  • idxs (array_like, optional) – linear indices of sub(basin) outlets, by default is None.

  • xy (tuple of array_like of float, optional) – x, y coordinates of sub(basin) outlets, by default is None.

  • ids (1D array of uint32, optional) – IDs of (sub)basins in same order as idxs, by default None

Returns:

(sub)basin map

Return type:

2D array of uint32