NCL Website header
NCL Home> Application examples> Data Analysis || Data files for some examples

Example pages containing: tips | resources | functions/procedures


EOF: Empirical Orthogonal Function

There are several EOF functions available.

Functions eofunc_n, eofunc_ts_n, eofunc_n_Wrap, eofunc_ts_n_Wrap, and eofunc_ts_n were added in NCL V6.4.0. These functions allow you to specify which dimension contains the observations, so you don't have to reorder the data beforehand.

See the eof_n_640.ncl scripts below for examples of using the new xxxx_n functions.

eof_0.ncl / eof_0_640.ncl: These scripts verify the output from eofunc and eofunc_ts by reading an ascii file containing box data from the book:

  John C Davis
  Statistics and Data Analysis in Geology
  Wiley, 2nd Edition, 1986
  Source Data: page 524 , EOF results: page 537

The results match the book exactly.

The eof_0.ncl and eof_0_640.ncl scripts produce identical results; eof_0_640.ncl uses functions eofunc_n and eofunc_ts_n (added in NCL V6.4.0) to avoid having to reorder the data.

Further illustrated:

  • reconstructing the original array from the calculated EOFs and Principal Components (time series)
  • computing the sum-of-squares of each EOF to verify that they are normalized
  • computing cross correlations of each component to verify there are no cross-component correlations

The source data is available here.
The output from running the above script is here.

eof_0a.ncl: Same as Eof_0 but here the data are weighted (cosine of latitude). The script illustrates how to 'unweight' the data.

The output from running the above script is here.

eof_1.ncl / eof_1_640.ncl: Read sea level pressure; extract the data spanning 1979-2003; calculate the first three EOFs over the North Atlantic region for the winter (DJF) season. The first EOF pattern is commonly identified as the North Atlantic Oscillation (NAO) mode.

lonFlip is used to rearrange the data to span -180 to 180. Then coordinate subscripting is used to extract the region of interest.

Finally, the resulting principal component time series is normalized by the weights used to get the time series of the mean areal amplitudes.

The eof_0.ncl and eof_0_640.ncl scripts produce identical results; eof_0_640.ncl uses functions eofunc_n and eofunc_ts_n (added in NCL V6.4.0) to avoid having to reorder the data.

The dataset use can be downloaded from:

eof_2.ncl eof_2_640.ncl: This is an example posted by David Pierce (Scripps). NCL uses code posted at the the Scripps site. The Scripps example only shows the results from the first EOF. This example shows three patterns and time series. This example was created to illustrate that NCL's eofunc / eofunc_n and eofunc_ts / eofunc_ts_n results match Pierce's. Note that no areal weighting was performed.

eof_3.ncl / eof_3_640.ncl: From a directory with many POP files, (1) read 30 years spanning years 270-279; (2) compute climatology; (3) compute anomalies; (4) mask out all regions but the Atlantic basin; (5) weight grid by area; (5) compute EOFs; and, (7) plot.

eof_4.ncl / eof_4_640.ncl: Use the approach outlined at the Climate Prediction Center to compute the Antarctic Oscillation (AAO) for the period 1979-2000: Read geopotential height data (source: Reanalysis-2); select 700hPa and data poleward of 20S; compute monthly climatologies and anomalies; weight observations; compute EOFs; normalize the principal components; and project the anomalies via regression.

eof_5.ncl / eof_5_640.ncl: Compute EOFs for the northern hemisphere height field at 500hPa. Use cd_calendar to create an array containing time in the form of YYYYMM. Then use ind to determine the index values corresponding data from 1979-2011. Read the desired data using NCL's coordinate subscripting. Compute standard EOFs via eofunc_Wrap and the corresponding time series via eofunc_ts_Wrap. Because we want to do a varimax rotation 6 EOFs were computed. This (neof=6) is arbitrary but it should be large enough to allow eofunc_varimax_Wrap to reorthogonalize the subset. Finally, eofunc_varimax_reorder is used to place the output into descending order. The attribute pcvar_varimax represents the variance explained after the varimax rotation has been applied.

eof_6.ncl / eof_6_640.ncl: Compute EOFs for the northern hemisphere January sea level pressures from 1989-2009. The eofunc_north is used to assess if eigenvalues are distinct.

if the prinfo argument is set to True. The following will be printed.

          dlam      low      pcvar     high    sig
(0)	8.28161   18.5539   26.8355   35.1171  True
(1)	5.68727   12.7416   18.4289   24.1161  True
(2)	3.76075   8.42548   12.1862   15.947   True
(3)	2.67866   6.00119   8.67985   11.3585  False

where 'dlam' is the 'shift' (North's term).