geoutils.Raster.filter#
- Raster.filter(method, size=3, sigma=1, engine='scipy', outlier_threshold=2.0, mp_config=None, **kwargs)#
Apply a filter to the array.
- Parameters:
method (
str|Callable[...,ndarray[tuple[Any,...],dtype[floating[Any] |integer[Any]]]]) – The filter to apply. Can be a string (“gaussian”, “median”, “mean”, “max”, “min”, “distance”) for built-in filters, or a custom callable that takes a 2D ndarray and returns one.size (
int) – Window size for filtermp_config (
MultiprocConfig|None) – Multiprocessing configuration.sigma (
int) – Optional standard deviation for Gaussian filtering. Only used when method=”gaussian”.engine (
Literal['scipy','numba']) – Optional engine to use for filtering, either “scipy” (default) or “numba”. Only used when method=”median”.outlier_threshold (
float) – The minimum difference abs(array - mean) for a pixel to be considered an outlier. Only used when method=”distance”.
:param kwargs : Additional keyword arguments passed to the underlying filter implementation.
- Return type:
TypeVar(RasterType, bound= RasterBase)- Returns:
A new Raster instance with the filtered data (or None if inplace).
- Raises:
ValueError – If the filter name is not one of the predefined options.
TypeError – If method is neither a string nor a callable.