environmentaltools.spatiotemporal.indicators.critical_boundary_retreat
- environmentaltools.spatiotemporal.indicators.critical_boundary_retreat(data_cube, threshold, t_start, t_end)[source]
Calculate critical boundary retreat between two time points.
Analyzes how the boundary of critical areas (defined by threshold exceedance) changes between two time points. This is useful for studying phenomena like shoreline retreat, vegetation boundary shifts, or pollution extent changes.
- Parameters:
data_cube (np.ndarray) – 3D array with shape (time, lat, lon) containing spatiotemporal data.
threshold (float) – Critical threshold defining the boundary.
t_start (int) – Time indices to compare.
t_end (int) – Time indices to compare.
- Returns:
contours_start, contours_end (list) – Contour coordinates at start and end times.
retreat_mask (np.ndarray) – Binary map showing retreat areas (1 = retreat occurred).
Notes
The function identifies contours of the critical threshold at both time points and computes areas that were above threshold initially but fell below threshold later, indicating boundary retreat.
Examples
>>> import numpy as np >>> data_cube = np.random.exponential(1, (50, 30, 30)) >>> contours_start, contours_end, retreat = critical_boundary_retreat( ... data_cube, threshold=1.5, t_start=5, t_end=45)