Windows

The pyspatialstats.windows module implements different window types for the sliding window approach used in the pyspatialstats.focal and pyspatialstats.rolling modules.

Two concrete implementations are provided: RectangularWindow and MaskedWindow. Custom implementations can be provided by subclassing the Window class, implementing the get_shape and get_mask methods and the masked properties.

from pyspatialstats import RectangularWindow

window = RectangularWindow((3, 3))
window.get_shape()
(3, 3)

RectangularWindow

The RectangularWindow class is a concrete implementation of the Window class. It’s shape is defined by either an integer, which yields a square window in any dimension, or a tuple of integers, representing the size of the window in each dimension.

MaskedWindow

The MaskedWindow class defines a window based on a boolean mask, allowing any shape of the window to be defined.