Module: svd svd.py

SVD decomposition of two fields

Imported modules
import LinearAlgebra
import Numeric
import Scientific.Statistics
import pyclimate.mctest
import pyclimate.mvarstatools
import pyclimate.pyclimateexcpt
import pyclimate.tools
import sys
import whrandom
Functions
CSCF
```CSCF ( sigmas )

```

### Cumulative squared covariance fraction

#### Argument:

`sigmas`
Covariances returned by svd()

Returns a Numeric Array with the Cumulative squared covariance fraction

SCF
```SCF ( sigmas )

```

### Get the squared covariance fraction of the modes

#### Argument:

`sigmas`
Covariances returned by svd()

Returns a Numeric array with the Squared covariance fraction

getcoefcorrelations
```getcoefcorrelations ( scoefs,  zcoefs )

```

Correlation between the temporal expansion coefficients

getcoefs
```getcoefs ( data,  svectors )

```

### Temporal expansion coefficients

#### Arguments:

`data`
Data to project onto the singular vectors, usually the same NumPy used to get the vectors.
`svectors`
Singular vectors (left or right) as returned by `svd()`
getvector
```getvector ( svectors,  ivect )

```

### Get the ivect-eth singular vector.

#### Arguments:

`svectors`
Matrix of eigenvectors returned by svd (P or Q)
`ivect`
The order of the eigenvector that must be returned

Returns the ivect-ieth spatial pattern

heterogeneousmaps
```heterogeneousmaps ( xdata,  ycoefs )

```

### Heterogeneous correlation maps

#### Arguments:

`xdata`
Data to be represented as heterogeneous correlation
`ycoefs`
Temporal expansion coefs to correlate with `xdata`. To get an heterogeneous map they must be left-`xdata` and right-`ycoefs` or right-`xdata` and left-`ycoefs`.
homogeneousmaps
```homogeneousmaps ( data,  svectors )

```

### Homogeneus correlation maps

#### Arguments:

`data`
Data to be represented as homogeneous correlation
`svectors`
Correspondent singular vectors as returned by `svd()`
makemctest
```makemctest (
Umaster,
Vmaster,
ldata,
rdata,
itimes,
ielems,
)

```

### Monte Carlo test on the congruence of the singular vectors

#### Arguments:

`Umaster`
Left singular vectors as returned by `svd()`
`Vmaster`
Right singular vectors as returned by `svd()`
`ldata`
Left data field
`rdata`
Right data field
`itimes`
Number of Monte Carlo runs
`ielems`
Number of records in each Monte Carlo subsample
Exceptions
excpt.SVDSubsetLengthException(vectors, len(Vmaster [ 0 ] ) )
numberofvectors
```numberofvectors ( svectors )

```

### Number of eigenvectors according to our storage rules.

#### Arguments:

`svectors`
Matrix of eigenvectors returned by svd() (P or Q)
svd
```svd ( sfield,  zfield )

```

### Given two fields, get the SVD of their covariance matrix.

#### Arguments:

`sfield`
Input left field
`zfield`
Input right field

#### Returns a tuple (P,S,Q) with:

`P`
The left singular vectors.
`S`
The covariance of each of the modes.
`Q`
The right singular vectors
Exceptions
excpt.SVDLengthException(len( sfield ), len( zfield ) )