pyflwdir.FlwdirRaster.moving_average#
- FlwdirRaster.moving_average(data: ndarray, n: int, weights: ndarray | None = None, restrict_strord: bool = False, strord: ndarray | None = None, nodata: float = -9999.0) ndarray#
Take the moving weighted average over the flow direction network
- Parameters:
data (array-like) – Values associated with graph cells. Use a 1D array for Flwdir and an array matching the raster shape for FlwdirRaster.
n (int) – number of up/downstream neighbors to include
weights (array-like, optional) – Per-cell weights. Equal weights are used if omitted.
restrict_strord (bool) – If True, limit the window to cells of same or smaller stream order.
strord (array-like of int, optional) – Stream-order map used when restrict_strord is True.
nodata (float, optional) – Nodata values which is ignored when calculating the average, by default -9999.0
- Returns:
Averaged values, with the same shape as data.
- Return type:
array