EOF decomposition based on SVD
Given a dataset as read from readdat, that is, a matrix NxM, with N the
number of samples and M the number of channels or spatial samples, these
functions and classes compute the unrotated EOF decomposition of the field,
the principal components and some utility routines.
For better stability the computations are carried out by means of singular
value decomposition.
|
Imported modules
|
|
import LinearAlgebra
import Numeric
import Scientific.Statistics
import pyclimate.mctest
import pyclimate.mvarstatools
import pyclimate.pyclimateexcpt
import pyclimate.pydcdflib
import pyclimate.tools
import sys
|
|
Functions
|
|
bartletttest
eofsasexplainedvariance
getchiprob
getgencol
getvariancefraction
mctesteofs
northtest
pcseriescorrelation
svdeofs
|
|
|
bartletttest
|
bartletttest ( lambdas, samples )
|
|
|
eofsasexplainedvariance
|
eofsasexplainedvariance (
eofs,
pcscaling=0,
lambdas=None,
)
|
|
|
getchiprob
|
getchiprob ( chival, dof )
|
|
|
getgencol
|
getgencol ( a, ncol=0 )
|
|
|
getvariancefraction
|
getvariancefraction ( lambdas )
|
|
|
mctesteofs
|
mctesteofs (
dataset,
eofs,
subsamples,
length,
)
Monte Carlo test for the stability of the EOFs
def mctesteofs(dataset,eofs,subsamples,length):
Test the leading master EOFs obtained from the complete sample and
input in eofs by means of a Monte Carlo test based on making
subsamples subsamples with length members in each
|
|
|
northtest
|
northtest ( lambdas, tsamples )
|
|
|
pcseriescorrelation
|
pcseriescorrelation (
pcs,
eofs,
dataset,
)
Calculates the correlation between the PCs and time series at each grid point.
Arguments:
-
pcs
- the PCs as returned by
svdeofs
-
eofs
- the EOFs as returned by
svdeofs
-
dataset
- the dataset
Returns an array which generalized columns are the correlation fields of the
original time series with each PC.
|
|
|
svdeofs
|
svdeofs ( dataset, pcscaling=0 )
Calculates de EOF decomposition of a field.
Arguments:
-
dataset
- NumPy array containing the field to be decomposed.
First dimension must be time.
-
pcscaling
- sets the scale factor of the PCs: 0 means eigenvalues
are PC variances and the EOFs are orthonormal. 1 means
PCs with unit variance and orthogonal EOFs. (Defaults to 0)
Returns a tuple containing: PCs, eigenvalues, EOFs
If the field has more than one spatial dimension it can be processed anyway
and each EOF can be recovered as generalized columns: EOFs[..., eofnumber]
|
|
Classes
|
|
SVDEOFs |
Class implementation of the EOF routines
|
|
|