NCL Home > Documentation > Functions > Empirical orthogonal functions


Computes empirical orthogonal functions (aka: Principal Component Analysis, Eigen Analysis) given an index that specifies which dimension contains the number of observations, and retains metadata.

Available in version 6.4.0 and later.


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_n_Wrap (
		data    : numeric,  
		neval   : integer,  
		optEOF  : logical,  
		dim [1] : integer   

	return_val  :  numeric



A multi-dimensional array in which the dim index specifies the dimension that contains the number of observations. Generally, this is the time dimension. 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.


The dimension index of data that represents the dimension containing the number of observations. Generally, this is the time dimension.


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