NCL Home > Documentation > Functions > Empirical orthogonal functions


Computes empirical orthogonal functions (aka: Principal Component Analysis, Eigen Analysis) and retains metadata.


load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"  ; This library is automatically loaded
                                                             ; from NCL V6.2.0 onward.
                                                             ; No need for user to explicitly load.

	function eofunc_Wrap (
		data    : numeric,  
		neval   : integer,  
		optEOF  : logical   

	return_val  :  numeric



A multi-dimensional array in which the rightmost dimension is the number of observations. Generally, this is the time dimension.

If your rightmost dimension is not time, then see eofunc_n_Wrap.

Commonly, the data array contains anomalies from some base climatology, however, this is not required.


A scalar integer that specifies the number of eigenvalues and eigenvectors to be returned. This is usually less than or equal to the minimum number of observations or number of variables, and is typically 3 to 5.


A logical variable to which various optional arguments may be assigned as attributes. These optional arguments alter the default behavior of the function. Must be set to True prior to setting the attributes which are assigned using the @ operator:

  • optEOF      = True
    optEOF@jopt = 1
    optEOF@jopt = 1: uses correlation matrix to compute EOFs. The default is to use a covariance matrix (optEOF@jopt = 0).
  • optEOF       = True
    optEOF@pcrit = 85
    optEOF@pcrit = %: a float value that indicates the percentage of non-missing points that must exist at any single point in order to be calculated. The default is 50%. Points that contain all missing values will automatically be set to missing.


This function is identical to eofunc, except the return value will have metadata added based on metadata attached to data. See the eofunc page for full documentation and examples.