climate.hilbert

Provides classes for generating and analyzing complex climate networks.

class pyunicorn.climate.hilbert.HilbertClimateNetwork(data, threshold=None, link_density=None, non_local=False, directed=True, node_weight_type='surface', silence_level=0)[source]

Bases: ClimateNetwork

Encapsulates a Hilbert climate network.

The associated similarity matrix is based on Hilbert coherence between time series.

Hilbert climate networks can be directed and undirected. Optional directionality is based on the average phase difference between time series.

A preliminary study of Hilbert climate networks is presented in [Donges2009c].

__cache_state__() Tuple[Hashable, ...][source]

Hashable tuple of mutable object attributes, which will determine the instance identity for ALL cached method lookups in this class, in addition to the built-in object id(). Returning an empty tuple amounts to declaring the object immutable in general. Mutable dependencies that are specific to a method should instead be declared via @Cached.method(attrs=(…)).

NOTE: A subclass is responsible for the consistency and cost of this state descriptor. For example, hashing a large array attribute may be circumvented by declaring it as a property, with a custom setter method that increments a dedicated mutation counter.

__init__(data, threshold=None, link_density=None, non_local=False, directed=True, node_weight_type='surface', silence_level=0)[source]

Initialize an instance of HilbertClimateNetwork.

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.

  • directed (bool) – Determines, whether the network is constructed as directed.

  • node_weight_type (str) – The type of geographical node weight to be used.

  • silence_level (int) – The inverse level of verbosity of the object.

__rec_cache_state__() Tuple[object, ...][source]

Similar to __cache_state__(), but lists attributes which are themselves instances of Cached. Empty by default.

__str__()[source]

Return a string representation.

_calculate_hilbert_correlation(anomaly)[source]

Calculate Hilbert coherence and phase matrices.

Output corresponds to modulus and argument of the complex correlation coefficients between all pairs of analytic signals calculated from anomaly data, as described in [Bergner2008].

Parameters:

anomaly (2D Numpy array [time, index]) – The anomaly data for network construction.

Return type:

tuple of two 2D Numpy matrices [index, index]

Returns:

the Hilbert coherence and phase matrices.

_set_directed(directed, calculate_coherence=True)[source]

Switch between directed and undirected Hilbert climate network.

Parameters:
  • directed (bool) – Determines whether the network is constructed as directed.

  • calculate_coherence (bool) – Determines whether coherence and phase are calculated from data or the directed adjacency matrix is constructed from coherence and phase information.

clear_cache()[source]

Clean up cache.

coherence()[source]

Return the Hilbert coherence matrix.

Return type:

2D Numpy array [index, index]

Returns:

the Hilbert coherence matrix.

data: ClimateData

The climate data used for network construction.

phase_shift()[source]

Return the average phase shift matrix.

Return type:

2D Numpy array [index, index]

Returns:

the average phase shift matrix.

set_directed(directed)[source]

Switch between directed and undirected Hilbert climate network.

Also performs the complete network generation.

Parameters:

directed (bool) – Determines whether the network is constructed as directed.