pyflwdir.FlwdirRaster.subgrid_rivslp#

FlwdirRaster.subgrid_rivslp(idxs_out, elevtn, length=1000, direction='both', method='mean', mask=None)[source]#

Returns the subgrid river slope [m/m] estimated at unit catchment outlet pixel. 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, if None the cell size (instead of subgrid length) will be used.

  • elevtn (2D array of float with self.shape, optional) – 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’.

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

  • method ({'mean', 'lstsq'}) – Estimate the segment slope based on the mean slope: i.e.: net difference in elevation divided by length; or lstsq slope: i.e.: a simple ordinary least squares regression estimate of slope

Returns:

rivslp – subgrid river slope [m/m]

Return type:

2D array of float with idxs_out.shape