oscardm20994 / Wavelet_analysis

package for wavelet analysis of non stationary spectral characteristics of timeseries data.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wavelet_analysis

Wavelet_analysis is a repository of python scripts to carry out spectral decomposition of tiemseries using a set of wavelet basis functions. The methodology is discussed extensively in Terrence and Compo et al.

Mathematical Approach

The wavelet transform of a uniform 1-dimensional time series, x, of length N and timestep δt is given by the convolution between the series and a scaled and translated version of a wavelet function ψ0

where s is the wavelet scale indicating the frequency of the wavelet. Varying s and translating along the time scale (the index n), Wn indicates the amplitude of signals at different scales and their variation in time. The scale s is increased in powers of 2 according to

where s0 is the shortest resolvable scale of a signal, J corresponds to the longest and δj is the scale resolution. The translated and scaled wavelet has the form

a common form of &psi0 is as a Morlet wavelet, an oscillatory function enveloped by a Gaussian which is expressed as

It is computationally quicker to compute the wavelet transform in discrete Fourier space. By the convolution theorem, the transform reduces to multiplication

where \hat{x}_{k} and \hat{&psi} are the discrete Fourier transforms of the time series x and the wavelet function respectively,

H(&omegak;) is the Heavyside function. The square modulus of the wavelet transform gives the wavelet power spectrum which indicates relative strength of signals in the time series as a function of signal period and discretised time. We also define a confidence interval for wavelet power observed at a given period and time for a series by assuming a mean background spectrum corresponding to that of a first order autoregressive (AR1, red noise) process modelled by

where α is the lag-1 autocorrelation of the time series and zn is Gaussian white noise. such a process's wavelet power spectrum is χ 2 distributed and therefore can be used to define a 95% confidence interval for any observed power. Additionally, the cross wavelet spectrum of two time series x and y with associated wavelet spectra Wxn and Wyn gives a measure of coincident power (the same period at the same timepoints) between the series. It is given by

where Wxn is the complex conjugate of the wavelet power spectrum of x. The complex argument of Wxyn gives the local phase difference between signals in x and y in frequency-time space. The phase relationship between the two time-series can be represented by a vector that subtends an angle representing the phase difference: On all plots of cross spectra, arrows to the right (left) denoted signals which are in-phase and correlated (anti-correlated). Vertical arrows indicate a phase relationship of π/2 between the time-series, so that the evolution of one is correlated with the rate-of-change of the other. As for individual power spectra, we define a confidence interval for which cross power of a larger amplitude is deemed significant (>95% confidence interval) by comparing power exhibited by actual series with a theoretical red noise process. The cross power of two such AR1 processes is theoretically distributed such that the probability of obtaining cross power greater than a set of red-noise processes is

where σ denotes the standard deviation of the time series, Z is the confidence interval defined by p (Z = 3.999 for 95% confidence), ν is the degrees of freedom for a real wavelet spectrum (ν = 2) and Pk is the theoretical Fourier spectrum of the AR1 process. For a given wavenumber k, this can be expressed as

Files

wavelet_lib.py - script containing functions to compute the wavelet transform, power spectra and significance tests on a timeseries. Functions are based on source code of the waipy package developed by Mabel Calim Costa (mabelcalim).

wavelet_plot.py - functions to plot wavelet spectra and cross spectra

wavelet_analysis.py - script to load data, call wavelet functions and output spectra

PDO_wavelet_UKESM_SON_DJF_5_yr_window.png - sample output of wavelet power spectra from climate model data

cross_coherence_SSWs_PDO_SON_UKESM.png - sample output of wavelet cross power spectra from climate model data.

Usage

This repository has been used for analysis in Dimdore-Miles et al. 2020 which analyses long term variability in stratospheric circulation indices.

About

package for wavelet analysis of non stationary spectral characteristics of timeseries data.


Languages

Language:Python 100.0%