climate.havlin¶
Provides classes for generating and analyzing complex climate networks.
-
class
pyunicorn.climate.havlin.
HavlinClimateNetwork
(data, max_delay, threshold=None, link_density=None, non_local=False, node_weight_type='surface', silence_level=0)[source]¶ Bases:
pyunicorn.climate.climate_network.ClimateNetwork
Encapsulates a Havlin climate network.
The similarity matrix associated with a Havlin climate network is the maximum-lag correlation matrix with each entry normalized by the cross-correlation function’s standard deviation.
Havlin climate networks are undirected so far.
Havlin climate networks were studied for daily data in [Yamasaki2008], [Gozolchiani2008], [Yamasaki2009].
Note
So far, the cross-correlation functions are estimated using convolution in Fourier space (FFT). This may not be reliable for larger delays.
-
__init__
(data, max_delay, threshold=None, link_density=None, non_local=False, node_weight_type='surface', silence_level=0)[source]¶ Initialize an instance of HavlinClimateNetwork.
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.
- max_delay (int) – Maximum delay for cross-correlation functions.
- 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.
- silence_level (int) – The inverse level of verbosity of the object.
- Possible choices for
-
_calculate_correlation_strength
(anomaly, max_delay, gamma=0.2)[source]¶ Calculate correlation strength and maximum lag matrices.
Follows the method described in [Yamasaki2008].
Also returns the time lag at maximum correlation for each link.
Parameters: - anomaly (2D array [time, index]) – The anomaly data for network construction.
- max_delay (int) – The maximum delay for cross-correlation functions.
- gamma (float) – The width of decay region in cosine shaped window used for FFT cross-correlation estimation.
Return type: tuple of two 2D arrays [index, index]
Returns: the correlation strength and maximum lag matrices.
-
_set_max_delay
(max_delay)[source]¶ Set the maximum lag time used for cross-correlation estimation.
Parameters: max_delay (int) – The maximum delay for cross-correlation functions.
-
clear_cache
(irreversible=False)[source]¶ Clean up cache.
If irreversible=True, the network cannot be recalculated using a different threshold, or link density.
Parameters: irreversible (bool) – The irreversibility of clearing the cache.
-
correlation_lag
()[source]¶ Return the lag at maximum cross-correlation matrix.
Return type: 2D array [index, index] Returns: the lag at maximum cross-correlation matrix.
-
correlation_lag_weighted_average_path_length
()[source]¶ Return correlation lag weighted average path length.
Return float: the correlation lag weighted average path length.
-
correlation_lag_weighted_closeness
()[source]¶ Return correlation lag weighted closeness.
Return type: 1D array [index] Returns: the correlation lag weighted closeness sequence.
-
correlation_strength
()[source]¶ Return the correlation strength matrix.
Return type: 2D array [index, index] Returns: the correlation strength matrix.
-
correlation_strength_weighted_average_path_length
()[source]¶ Return correlation strength weighted average path length.
Return float: the correlation strength weighted average path length.
-
correlation_strength_weighted_closeness
()[source]¶ Return correlation strength weighted closeness.
Return type: 1D array [index] Returns: the correlation strength weighted closeness sequence.
-
get_max_delay
()[source]¶ Return the maximum delay used for cross-correlation estimation.
Return float: the maximum delay used for cross-correlation estimation.
-
local_correlation_lag_weighted_vulnerability
()[source]¶ Return correlation lag weighted vulnerability.
Return type: 1D array [index] Returns: the correlation lag weighted vulnerability sequence.
-