pyflwdir.FlwdirRaster.subbasins#

FlwdirRaster.subbasins(riv_mask: ndarray) → tuple[ndarray, ndarray][source]#

Return a subbasin map with unique IDs starting from 1.

Parameters:

riv_mask (2D array of bool) – Boolean mask of river cells. For example, derive it from a minimum upstream-area or stream-order threshold.

Returns:

  • subbas (2D-array of int32) – Raster of unique subbasin IDs.

  • idxs_out (1D array of int) – Linear indices of subbasin outlet cells.