11.07.2015 Views

PyClimate 1.1. A set of C and Python routines for the ... - Starship

PyClimate 1.1. A set of C and Python routines for the ... - Starship

PyClimate 1.1. A set of C and Python routines for the ... - Starship

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

jQb]]]6 Simple multivariate statistical toolsThe main goal <strong>of</strong> file mvarstatools.py is to provide some <strong>routines</strong> that are beingused by o<strong>the</strong>rs like svde<strong>of</strong>s.py. However, some <strong>of</strong> <strong>the</strong>m may be interesting by<strong>the</strong>mselves, <strong>and</strong> <strong>the</strong>y are thus documented in this section.Function: def center(data<strong>set</strong>)Given an input multivariate data<strong>set</strong> with arbitrary dimensions (with <strong>the</strong> restrictionthat first dimension is time), this function returns <strong>the</strong> centered !#"$&%(' data<strong>set</strong>,*,+.- +with <strong>the</strong> ')" / sample average ' .Function: def st<strong>and</strong>ardize(data<strong>set</strong>)Given an input multivariate data<strong>set</strong> with arbitrary dimensions (with - <strong>the</strong> +1032 restriction465 , " that first dimension is time), this function returns <strong>the</strong> st<strong>and</strong>ardized data<strong>set</strong>with 7 -<strong>the</strong> sample st<strong>and</strong>ard deviation 7 - "Function: def covariancematrix(X,Y)Given two input data<strong>set</strong>s @* +:9;- +10=? 8. /<strong>and</strong> A , with first dimension time <strong>and</strong> second dimension9;D 0 D =FE 9HG 0 G =/ space, this function returns <strong>the</strong> S–mode covariance matrix .BC"Function: def correlationmatrix(X,Y)Given two input data<strong>set</strong>s <strong>and</strong> , with first dimension time @<strong>and</strong> A second dimension/ space, this function BI"returns <strong>the</strong> S–mode correlation matrix from <strong>the</strong> st<strong>and</strong>-E - - ardized J <strong>and</strong> data<strong>set</strong>s.Function: def detrend(data<strong>set</strong>,tvalues,order=1)From <strong>the</strong> univariate time series data<strong>set</strong>, this function returns a tuple (detrended,trendcoefs).The trend is computed adjusting by means <strong>of</strong> linear least squares a polinomialto <strong>the</strong> data, V where is order. The tuple holds <strong>the</strong> detrended time*,PQHRTSU Q L KLNMO"series as <strong>the</strong> first member <strong>and</strong> <strong>the</strong> <strong>the</strong> trend U Q coefficients as <strong>the</strong> second element <strong>of</strong> <strong>the</strong>tuple.Function: def congruence(pattern1,pattern2)Given two spatial patterns pattern1 W (X.Z), this function returns <strong>the</strong>^ ? ^`_a7 EOF analysis^ _ bcbcongruence coefficient [ Y\ Z " ]) <strong>and</strong> pattern2 ( WX>Y? b [3, 13]. ^A subroutine is provided in <strong>the</strong> file svde<strong>of</strong>s.py to per<strong>for</strong>m <strong>the</strong> decomposition <strong>of</strong> adata<strong>set</strong> in its spatial eigenvectors (Empirical Orthogonal Functions, EOFs), <strong>the</strong> fraction<strong>of</strong> variance explained by each mode <strong>and</strong> its temporal expansion coefficients [11, 15](PCs). One <strong>of</strong> <strong>the</strong> problems <strong>of</strong> this technique in climatological analysis is <strong>the</strong> singularity<strong>of</strong> covariance matrices when <strong>the</strong> number <strong>of</strong> spatial degrees <strong>of</strong> freedom is biggerthan <strong>the</strong> number <strong>of</strong> temporal samples. To avoid this problem, <strong>the</strong> routine is basedon <strong>the</strong> SVD decomposition <strong>of</strong> <strong>the</strong> data @d"fe Qcgih matrix . For this implementation,means a temporal sample <strong>and</strong> qr"lknmomim`V a grid point or observing site."lknmimomNpCorrections derived from quadrature or area factors [2, 10] must be applied prior to thisroutine. There is an example on <strong>the</strong> use <strong>of</strong> <strong>the</strong>se function in file exsvde<strong>of</strong>s.py.NEW: Since version 1.1, <strong>the</strong> input data <strong>set</strong> may be arbitrarily shaped, with <strong>the</strong> onlyrestriction that <strong>the</strong> leading axis must be <strong>the</strong> time axis.Function: def svde<strong>of</strong>s(data<strong>set</strong>, pcscaling=0)Given a two dimensional data<strong>set</strong> ptsuVas described above, this function returns atuple v ,w ,x . v"ye z Y{ mimom { z6| h is a pfs~} matrix, where each column z> is a vector<strong>of</strong> length p <strong>and</strong> is <strong>the</strong> € –eth PC <strong>of</strong> <strong>the</strong> field. Each element < in <strong>the</strong> one dimensional9

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!