Pyleoclim Utilities API (pyleoclim.utils)
Pyleoclim makes extensive use of functions from numpy, Pandas, Scipy, and scikitlearn. 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.
MonteCarlo Principal Component Analysis (PCA, sometimes known as EOF analysis) 

Singular Spectrum Analysis 

Multi Channel Singular Spectrum Analysis. 
Filter
Filtering functions
Smooth (and optionally differentiate) data with a SavitzkyGolay filter 

Applies a Butterworth filter with frequency fc, with optional padding 

Applies a Finite Impulse Response filter design with window method and frequency fc, with padding 

Applies a Lanczos (lowpass) 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 

Closes the figure 

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 multitaper method 

Estimate power spectral density using the LombScargle method 

Estimate power spectral density using the Weighted ZTransform 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 lag1 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 

Generate AR(1) series samples 
Wavelet
Functions for wavelet analysis. Includes some preprocessing and postprocessing functions for spectral and wavelet analysis described here.
Weighted wavelet amplitude (WWA) for unevenlyspaced data 

Crosswavelet analysis for unevenlyspaced data. 
Tsutils
This modules contain preprocessing functions for time series analysis.
Computes the mean, median, min, max, standard deviation and interquartile range of a timeseries 

Bin the values into evenlyspaced 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 

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, lowpass filter, or decompositionbased detrending 

Detect outliers in a timeseries 

Remove outliers in a timeseries 
Tsbase
This module contains simple cleaning routines.
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 

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 humanreadable 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 