pyflwdir.FlwdirRaster.subgrid_rivslp#
- FlwdirRaster.subgrid_rivslp(idxs_out: ndarray | None, elevtn: ndarray, length: float = 1000, direction: Literal['both', 'up', 'down'] = 'both', method: Literal['mean', 'lstsq'] = 'mean', mask: ndarray | None = None) ndarray[source]#
Return the subgrid river slope [m/m] estimated at unit-catchment outlets.
The slope is estimated from the elevation around the outlet pixel (direction=’both’), or between the outlet pixel and the next downstream (direction=’down’) or next upstream (direction=’up’) outlet pixel.
- Parameters:
idxs_out (2D array of int) – Linear indices of unit catchment outlets
elevtn (2D array of float with self.shape) – Elevation raster, required to calculate slope.
length (float, optional) – Subgrid river length [m] over which to calculate the slope, by default 1000 m. Only used in combination with direction = ‘both’
direction ({"both", "up", "down"}) – Flow direction in which river slope is measured, by default ‘both’.
method ({'mean', 'lstsq'}, optional) – Estimate slope from the net elevation difference divided by length (‘mean’) or by least-squares regression (‘lstsq’), by default ‘mean’.
mask (2D array of bool with self.shape, optional) – True for valid pixels. Can be used to mask out pixels of small rivers.
- Returns:
rivslp – subgrid river slope [m/m]
- Return type:
2D array of float with idxs_out.shape