climate.spearman¶
Provides classes for generating and analyzing complex climate networks.
- class pyunicorn.climate.spearman.SpearmanClimateNetwork(data, threshold=None, link_density=None, non_local=False, node_weight_type='surface', winter_only=True, silence_level=0)[source]¶
Bases:
TsonisClimateNetwork
Encapsulate a Spearman climate network.
The Spearman climate network is constructed from the Spearman rank order correlation matrix (Spearman’s rho). Spearman’s rho is more robust with respect to ouliers and non-gaussian data distributions than the Pearson correlation coefficient used in
TsonisClimateNetwork
.Hence, Spearman climate networks are undirected due to the symmetry of the Spearman’s rho matrix.
- __init__(data, threshold=None, link_density=None, non_local=False, node_weight_type='surface', winter_only=True, silence_level=0)[source]¶
Initialize an instance of
SpearmanClimateNetwork
.Note
Either threshold OR link_density have to be given!
- Possible choices for
node_weight_type
: None (constant unit weights)
“surface” (cos lat)
“irrigation” (cos**2 lat)
- Parameters:
data (
ClimateData
) – The climate data used for network construction.threshold (float) – The threshold of similarity measure, above which two nodes are linked in the network.
link_density (float) – The networks’s desired link density.
non_local (bool) – Determines, whether links between spatially close nodes should be suppressed.
node_weight_type (str) – The type of geographical node weight to be used.
winter_only (bool) – Determines, whether only data points from the winter months (December, January and February) should be used for analysis. Possibly, this further suppresses the annual cycle in the time series.
silence_level (int) – The inverse level of verbosity of the object.
- Possible choices for
- _calculate_correlation(anomaly)[source]¶
Return Spearman’s rho matrix at zero lag.
- Parameters:
anomaly (2D Numpy array (time, index)) – the anomaly time series from to calculate the correlation matrix at zero lag.
- Return type:
2D Numpy array (index, index)
- Returns:
the Spearman’s rho matrix at zero lag.