Introduction

Note

eof2 has been replaced by eofs. eof2 is still functional but it is not likely to be maintained any further. Please consider switching to eofs for new installations.

eof2 is a Python package for EOF analysis of spatial-temporal data. Some of the key features of eof2 are:

  • Suitable for large data sets: computationally efficient for the large output data sets of modern climate models.
  • Transparent handling of missing values: missing values are removed automatically when computing EOFs and placed back into output fields.
  • Automatic metadata: metadata from input fields is used to construct metadata for output fields (requires the cdms2 module).
  • No Fortran dependencies: a fast implementation written in Python using the power of numpy, so no compilers required.

Download and Installation

The package can be downloaded from github. To get the latest source and install the module on your system run:

$ git clone git://github.com/ajdawson/eof2.git
$ cd eof2
$ sudo python setup.py install

or download a zip file from the project’s code page.

Getting Started

The eof2 package provides two interfaces for EOF analysis: one for numpy arrays or masked arrays; and one for cdms2 variables, which preserves metadata. The two interfaces support exactly the same sets of operations.

Regardless of which interface you use, the basic usage is the same. The EOF analysis is handled by eof2.Eof (or eof2.EofSolver for the numpy interface). The EOF solution is computed when an instance of eof2.Eof (or eof2.EofSolver) is initialized. Method calls are then used to return quantities of interest.

The following is a very simple illustrative example which computes the leading 2 EOFs of a temporal spatial field:

import cdms2
from eof2 import Eof

# Read a spatial-temporal field. Time must be the first dimension.
ncin = cdms2.open('sst_monthly.nc')
sst = ncin('sst')
ncin.close()

# Initialize and Eof object. Square-root of cosine of latitude weights
# are used.
solver = Eof(sst, weights='coslat')

# Retrieve the first two EOFs.
eofs = solver.eofs(neofs=2)

Requirements

This package requires as a minimum that you have numpy available. The metadata enabled interface can only be used if the cdms2 module is also available. This module is distributed as part of the UV-CDAT project. It is also distributed as part of the cdat_lite package.

Developing and Contributing

All development is done through the github system. To check out the latest sources run:

$ git clone git://github.com/ajdawson/eof2.git

Please file bug reports and feature requests using the github issues.

Table Of Contents

Previous topic

eof2’s Documentation

Next topic

EOF Analysis

This Page