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.
Notes
The subbasins and their outlets are the same for every ordering set with order_cells (see its Notes). Their IDs follow the sequence though, so which subbasin gets which ID, and the order of idxs_out, change with the method.