Pyleoclim Utilities (pyleoclim.utils)¶
Pyleoclim makes extensive use of functions from numpy, Pandas, Scipy, and scikit-learn. Please note that some default parameter values for these functions have been changed to more appropriate values for paleoclimate datasets.
Causality¶
Estimate Granger causality |
|
Estimate Liang causality |
Correlation¶
Estimates the Pearson’s correlation and associated significance between two time series, applicable to cases where the standard assumption of independence breaks down. Three methods are currently implemented: t test with a heuristic correction for the degrees of freedom, Monte Carlo simulations based on an AR(1) model (isopersist), and phase randomization (isospectral). |
|
False Discovery Rate, as per the method of Benjamini and Hochberg [1995] |
Decomposition¶
Methods used for decomposing timeseries into orthogonal components.
Filter¶
Filtering functions
Smoothe (and optionally differentiate) data with a Savitzky-Golay filter |
|
Applies a Butterworth filter with frequency fc, with optional padding |
Mapping¶
This module contains mapping function based on cartopy <https://scitools.org.uk/cartopy/docs/latest/>_
Maps records according to some criteria (e.g, proxy type, interpretation) |
Plotting¶
The functions contained in this module rely heavily on matplotlib <https://matplotlib.org>_. See here for details. If considering plotting without making use of the functions in the ui module, we recommend using matplotlib directly.
However, the following functions can be used to manipulate the default style and save settings.
Shows the figure |
|
Saves the figure to a user specified path |
|
Modifies the visualization style |
Spectral¶
This modules contains several spectral methods applicable to paleoclimate data
Estimate power spectral density using Welch’s method |
|
Estimate power spectral density using periodogram method |
|
Estimate power spectral density using multi-taper method |
|
Estimate power spectral density using the Lomb-Scargle method |
|
Estimate power spectral density using the Weighted Z-Transform wavelet method |
Tsmodel¶
This module generates simulated time series that can be used for significance testing.
Produces p realizations of an AR(1) process of length n with lag-1 autocorrelation g calculated from y and (if provided) t |
|
Generate a colored noise with given scaling factor alpha |
|
Generate a colored noise with two regimes given scaling factors alpha1 and alpha2 |
Wavelet¶
Functions for wavelet analysis. Includes some pre-processing and post-processing functions for spectral and wavelet analysis described here.
Weighted wavelet amplitude (WWA) for unevenly-spaced data |
|
Continous wavelet transform for evenly spaced data |
|
Cross-wavelet analysis for unevenly-spaced data. |
Tsutils¶
This modules contain pre-processing functions for time series analysis.
Computes the mean, median, min, max, standard deviation and interquartile range of a timeseries |
|
Bin the values into evenly-spaced bins |
|
Coarsen time resolution using a Gaussian Kernel |
|
Establishes the grid properties of a numerical array |
|
Interpolation function based on scipy.interpolate.interp1d <https://docs.scipy.org/doc/scipy/reference/generated/scipy.interpolate.interp1d.html>_ |
|
Places two timeseries on a common time axis |
|
Standardizes a timeseries |
|
Chop a timeseries into several segments based on gap detection |
|
Remove NaNs in the time series and sort it in ascending time order |
|
Remove NaNs |
|
Sort time values in ascending order |
|
Reduce duplicated timestamps in a timeseries by averaging the values |
|
Annualize a time series whose time resolution is finer than 1 year |
|
Maps a (proxy) timeseries to a Gaussian distribution |
|
Transforms a single (proxy) timeseries to a Gaussian distribution |
|
Applies linear, constant, low-pass filter, or decomposition-based detrending |
|
Detect outliers in a timeseries |
|
Remove outliers in a timeseries |
|
Detect whether a timeseries is evenly spaced in time |
Lipdutils¶
This module contains functions to manipulate LiPD files and automate data transformation whenever possible. These functions are used throughout Pyleoclim but are not meant for direct interactions. A list of these functions can be found here.
The most relevant functions concern querying the LinkedEarth wiki. The first 5 functions can be used to get relevant query terms.
Query the names of all ArchiveTypes from the LinkedEarth Ontology |
|
Query the names of all ProxyObservations from the LinkedEarth Ontology |
|
Query the names of all ProxySensors from the LinkedEarth Ontology |
|
Query the names of all InferredVariables from the LinkedEarth Ontology |
|
Query the names of all Interpretations from the LinkedEarth Ontology. |
|
Query the LinkedEarth wiki for datasets. |
jsonutils¶
This module converts Pyleoclim objects to and from JSON files. Useful for obtaining a human-readable output and keeping the results of an analysis.
Saves a Pyleoclim Object (e.g., Series, PSD, Scalogram) to a json file |
|
Load a pyleoclim Series object from a JSON file |
|
Load a pyleoclim PSD object from a JSON file |
|
Load a pyleoclim Scalogram object from a JSON file |