geoutils.Raster.filter

Contents

geoutils.Raster.filter#

Raster.filter(method, inplace=False, size=3, **kwargs)[source]#

Apply a filter to the array.

Parameters:
  • method (Union[str, Callable[..., ndarray[tuple[Any, ...], dtype[Union[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.

  • inplace (bool) – Whether to modify the raster in-place.

  • size (int) – window size for filter

Return type:

Optional[TypeVar(RasterType, bound= Raster)]

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.