pyflwdir.FlwdirRaster.subgrid_rivlen#

FlwdirRaster.subgrid_rivlen(idxs_out, mask=None, direction='up', unit='cell')[source]#

Returns the subgrid river length [m] based on unit catchment outlet locations. A cell’s subgrid river is defined by the path starting at the unit catchment outlet pixel moving up- or downstream until it reaches the next outlet pixel. If moving upstream and a pixel has multiple upstream neighbors, the pixel with the largest upstream area is selected.

Parameters:
  • idxs_out (2D array of int) – Linear indices of unit catchment outlets. If None (default) the cell size (instead of subgrid length) will be used.

  • mask (2D array of bool with self.shape, optional) – True for valid pixels. can be used to mask out pixels of small rivers.

  • direction ({"up", "down"}) – Flow direction in which river length is measured, by default ‘up’.

  • unit ({'m', 'cell'}) – Upstream area unit.

Returns:

rivlen – subgrid river length [m]

Return type:

2D array of float with idxs_out.shape