environmentaltools.spatiotemporal.indicators.spatiotemporal_coupling
- environmentaltools.spatiotemporal.indicators.spatiotemporal_coupling(cube_x, cube_y)[source]
Calculate spatiotemporal coupling between two variables.
Computes the temporal correlation between two variables for each spatial location. This identifies areas where variables are strongly coupled versus areas where they vary independently.
- Parameters:
cube_x (np.ndarray) – 3D arrays with shape (time, lat, lon) for the two variables.
cube_y (np.ndarray) – 3D arrays with shape (time, lat, lon) for the two variables.
- Returns:
coupling_map – 2D map of temporal correlation coefficients (-1 to 1).
- Return type:
np.ndarray
Notes
Correlation is computed independently for each spatial location across the time dimension. Values near 1 indicate strong positive coupling, values near -1 indicate strong negative coupling, and values near 0 indicate weak or no coupling.
Examples
>>> import numpy as np >>> cube_x = np.random.random((100, 20, 20)) >>> cube_y = np.random.random((100, 20, 20)) >>> coupling = spatiotemporal_coupling(cube_x, cube_y)