pyflwdir.FlwdirRaster.subgrid_rivavg#

FlwdirRaster.subgrid_rivavg(idxs_out, data, weights=None, nodata=-9999.0, mask=None, direction='up')[source]#

Returns the average value over the subgrid river, based on unit catchment outlet locations. The 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.

  • data (2D array) – values

  • weigths (2D array, optional) – weights used for averaging, by default None.

  • nodata (int or float, optional) – Missing data value for cells outside domain, by default -9999.0

  • 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 segment is defined, by default ‘up’.

Returns:

rivavg – subgrid segment average

Return type:

2D array of float with idxs_out.shape