pyflwdir.FlwdirRaster.subgrid_rivmed#
- FlwdirRaster.subgrid_rivmed(idxs_out: ndarray | None, data: ndarray, weights: ndarray | None = None, nodata: float = -9999.0, mask: ndarray | None = None, direction: Literal['up', 'down'] = 'up') ndarray[source]#
Return the median value over the subgrid river at unit-catchment outlets.
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, use each raster cell as an outlet.
data (2D array) – Values for which to calculate the median.
weights (2D array, optional) – Deprecated. This argument is ignored and will be removed in a future version.
nodata (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 exclude pixels outside the river.
direction ({"up", "down"}) – Flow direction in which the segment is defined, by default ‘up’.
- Returns:
rivmed – Median value for each subgrid river segment.
- Return type:
2D array of float with idxs_out.shape