environmentaltools.spatiotemporal.indicators.neighbourhood_polarization
- environmentaltools.spatiotemporal.indicators.neighbourhood_polarization(data_cube, size=3)[source]
Calculate polarization as local standard deviation.
Computes the temporal standard deviation of differences between each cell and its neighborhood mean. This measures local variability and identifies areas of high temporal polarization.
- Parameters:
data_cube (np.ndarray) – 3D array with shape (time, lat, lon) containing spatiotemporal data.
size (int, optional) – Neighborhood size. Default is 3.
- Returns:
polarization_map – 2D map of average polarization.
- Return type:
np.ndarray
Notes
High polarization values indicate areas where the relationship between a cell and its neighbors varies significantly over time. Low values suggest stable neighborhood relationships.
Examples
>>> import numpy as np >>> data_cube = np.random.random((30, 25, 25)) >>> polarization_map = neighbourhood_polarization(data_cube, size=3)