environmentaltools.spatiotemporal.indicators.mean_representative_value
- environmentaltools.spatiotemporal.indicators.mean_representative_value(data_cube, time_window=None)[source]
Calculate representative mean value for each spatial cell.
Computes the temporal mean for each spatial location, optionally within a specified time window. This provides a representative value that summarizes the typical condition at each location.
- Parameters:
data_cube (np.ndarray) – 3D array with shape (time, lat, lon) containing spatiotemporal data.
time_window (tuple of int, optional) – Time indices to use (start, end). If None, uses the entire time period.
- Returns:
mean_map – 2D map of representative mean values for each spatial cell.
- Return type:
np.ndarray
Notes
When time_window is specified, only the data within that temporal subset is used for computing means. This is useful for analyzing seasonal patterns or specific time periods of interest.
Examples
>>> import numpy as np >>> data_cube = np.random.normal(10, 2, (365, 30, 30)) # Daily data >>> # Full year average >>> mean_all = mean_representative_value(data_cube) >>> # Summer months (June-August, assuming daily data starting Jan 1) >>> mean_summer = mean_representative_value(data_cube, time_window=(150, 243))