semantique.processor.arrays.Array.smooth#
- Array.smooth(reducer, dimension, size, limit=2, fill=False, track_types=True, **kwargs)[source]#
Apply the smooth verb to the array.
The smooth verb smoothes the values in an array by applying a reducer function to a rolling window along a dimension.
- Parameters:
reducer (
callable
) – The reducer function to be applied to the rolling window.dimension (
str
) – Name of the dimension to smooth along.size (
int
) – Size k defining the extent of the rolling window. The pixel being smoothed will always be in the center of the window, with k pixels at its left and k pixels at its right. If the dimension to smooth over is the spatial dimension, the size will be used for both the X and Y dimension, forming a square window with the smoothed pixel in the middle.limit (
int
) – Minimum number of valid data values inside a window. If the window contains less than this number of data values (excluding nodata) the smoothed value will be nodata.fill (
bool
) – Should pixels with a nodata value also be smoothed?track_types (
bool
) – Should the reducer promote the value type of the output object, based on the value type of the input object?**kwargs – Additional keyword arguments passed on to the reducer function. These should not include a keyword argument “dim”, which is reserved for specifying the dimension to reduce over.
- Returns:
- Raises:
exceptions.UnknownDimensionError – If a dimension with the given name is not present in the array.