Data Analysis ||
Data files for some examples
Example pages containing:
Spectral Analysis and Complex Demodulation
Spectral analysis of time series is the process of partitioning the temporal variance information
into frequency variance information. The latter is called the spectrum
The spectrum breaks the sample variance of time series into discret components,
each of which is associated with a particular frequency.
A nice simple example of the concept and process is provided at
Introduction to Spectral Analysis (D. Percival, U. Washington).
The NCL functions specx_anal and specxy_anal
perform the temporal-to-frequency transformation via the
Fast Fourier Transform (FFT).
The FFT implicitly assume the time series are 'cyclic'. Generally, this is not true.
Hence, the source time series must be pre-treated (aka, "pre-whitening").
In most applications, this means the data must be tapered in the time or frequency domains.
NCL's functions perform the tapering in the time domain. Further, removing any linear
trend in the source data is recommended. The trend removal is performed first, then the
trend-removed data are tapered. This combination minimizes "ringing" and "leakage".
The FFT performed on the pre-whitened series create periodogram estimates. Nominally,
each periodogram estimate has 2 degrees of freedom for each frequency band.
("Nominally" because the source data has been pre-whitened which slightly reduces
the degrees of freedom..) To provide some level
of statistical reliability, the periodogram estimates must be smoothed.
For example, a 5-point smoother would nominally result in 10 degrees of freedom (5*2).
The side effect of the smoothing process is that the effective band-width is wider
(think, 5*periodogram-band-width). A nice description is at:
Spectral Analysis: Smoothed Periodogram Method (DMeko, U. Arizona).
: Reads in a time series from
a netCDF file, calculates the spectrum and plots the results.
specx_anal: Calculates the spectra of a time series with options on
smoothing, demeaning, detrending, and tapering.
dimsizes: calculates the dimension sizes of any array.
: Reads in two time series
and calculates their spectra, cospectra, coherence, quadrature spectra,
and phase and creates a panel plot of all values.
specxy_anal: Calculates the cospectra, coherence-squared, quadrature
spectra, and phase as well as the spectra of two time series with
options on smoothing, demeaning, detrending, and tapering.
The coherence-squared is a statistic that can be used to examine the relation between
two signals or data sets. It allows identification of significant frequency-domain
correlation between the two time series. Phase estimates in the cross spectrum are
only useful where significant frequency-domain coherence-squared exists. The
6.4.0 release contains two functions that can be used to test for significance:
cohsq_c2p and cohsq_p2c.
gsn_panel is the plot interface that panels plots together.
More examples of panel plots.
: Calculates red noise
confidence intervals and creates several plot variations.
calculates a red noise confidence interval. This function
returns four curves: the calculated spectrum, the "red noise" curve
and the curves indicating the upper and lower confidence bounds.
: Plots spectra and
"red noise" confidence intervals on a log scale and draws the bandwidth.
30.0, Changes the Y-axis to log and manually
sets the lower and upper limits.
are used to add the bandwidth line and label to the figure.
: A variation of Example 4.
The leftmost plot uses frequency as the abscissa. The two rightmost plots
use period (1/fequency) as the abscissa. Since the period is not linear,
plotting a subset of all the periods may be more useful. The ind
function is used to select the desired indices. The rightmost plot illustrates
how to reverse the abscissa order.
Reproduce Bloomfield's demodulation of Wolf's annual sun spot series (1700-1960) using NCL's
The modulation period used is 22 years (frqdem
The is figure 6.9 on page 141. The amplitude is very slightly
due to NCL's use of a different filter (filwgts_lanczos
(likely) a different low-pass filter cut-off frequency. The phase plots are the principal
Read and unpack daily sea-level-pressures (slp) from NCEP-1 grid points surrounding
Kanton Island (2.8N, 188.325E). Perform a simple areal average. Perform a complex
demodulation about a period of 35 days (frqdem
the Madden-Julian Oscillation (MJO) is described as having a 30-60 day period.