focal.focal_mean
- focal.focal_mean(a: Array, *, window: int | tuple[int, ...] | list[int] | ndarray[tuple[int, ...], bool] | Window, fraction_accepted: float = 0.7, verbose: bool = False, reduce: bool = False, chunks: int | tuple[int, int] | None = None, error: Literal['bootstrap', 'parametric'] | None = None, bootstrap_config: BootstrapConfig | None = None, out: MeanResult | None = None) MeanResult
Focal mean
- Parameters:
a (Array) – Input array to compute the focal mean on. Must be two-dimensional.
window (int, array-like, or Window) –
Window applied over the input array. It can be:
An integer (interpreted as a square window),
A sequence of integers (interpreted as a rectangular window),
A boolean array,
Or a
pyspatialstats.windows.Windowobject.
fraction_accepted (float, optional) –
Fraction of valid (non-NaN) cells per window required for computation.
0: all views are used if at least 1 value is present1: only fully valid views are usedBetween
0and1: minimum fraction of valid cells required
Default is 0.7.
verbose (bool, optional) – If True, print progress message with timing. Default is False.
reduce (bool, optional) – If True, uses each pixel exactly once without overlapping windows. The resulting array shape is
a_shape / window_shape. Default is False.chunks (int or tuple of int, optional) – Shape of chunks to split the array into. If None, the array is not split into chunks, which is the default.
error ({'parametric', 'bootstrap'}, optional) – Error type to compute. If None, no error is computed, which is the default.
bootstrap_config (BootstrapConfig, optional) – Bootstrap configuration object.
out (MeanResult, optional) – MeanResult object to update in-place
- Returns:
Dataclass containing the focal mean array and (optionally) uncertainty measures.
- Return type:
MeanResult