% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/EOF.R
\name{EOF}
\alias{EOF}
\title{Area-weighted empirical orthogonal function analysis using SVD}
\usage{
EOF(ano, lat, lon, time_dim = "time", space_dim = c("lat", "lon"),
  neofs = 15, corr = FALSE, ncores = NULL)
}
\arguments{
\item{ano}{A numerical array of anomalies with named dimensions to calculate
EOF. The dimensions must have at least 'time_dim' and 'space_dim'.}

\item{lat}{A vector of latitudes of 'ano'.}

\item{lon}{A vector of longitudes of 'ano'.}

\item{time_dim}{A character string indicating the name of the time dimension
of 'ano'.}

\item{space_dim}{A vector of two character strings. The first is the dimension
name of latitude of 'ano' and the second is the dimension name of longitude
of 'ano'. The default value is c('lat', 'lon').}

\item{neofs}{An integer of the modes to be kept. The default value is 15.
If time length or the product of latitude length and longitude length is 
less than neofs, neofs is equal to the minimum of the three values.}

\item{corr}{A logical value indicating whether to base on a correlation (TRUE)
or on a covariance matrix (FALSE). The default value is FALSE.}

\item{ncores}{An integer indicating the number of cores to use for parallel 
computation. The default value is NULL.}
}
\value{
A list containing:
\item{EOFs}{
 An array of EOF patterns normalized to 1 (unitless) with dimensions 
 (number of modes, rest of the dimensions of ano except 'time_dim'). 
 Multiplying \code{EOFs} by \code{PCs} gives the original reconstructed 
 field.
}
\item{PCs}{
 An array of principal components with the units of the original field to 
 the power of 2, with dimensions (number of time steps, number of modes). 
 \code{PCs} contains already the percentage of explained variance so, 
 to reconstruct the original field it's only needed to multiply \code{EOFs} 
 by \code{PCs}.
} 
\item{var}{
 A vector indicating the percentage (%) of variance fraction of total 
 variance explained by each mode (number of modes).
}
\item{mask}{
 The mask with dimensions (number of latitudes, number of longitudes).
}
\item{wght}{
 The weights with dimensions (number of latitudes, number of longitudes).
}
}
\description{
Perform an area-weighted EOF analysis using SVD based on a covariance matrix 
by default, based on the correlation matrix if \code{corr} argument is set to 
\code{TRUE}.
}
\examples{
# This example computes the EOFs along forecast horizons and plots the one that 
# explains the greatest amount of variability. The example data is very low 
# resolution so it does not make a lot of sense.
\dontshow{
startDates <- c('19851101', '19901101', '19951101', '20001101', '20051101')
sampleData <- s2dv:::.LoadSampleData('tos', c('experiment'),
                                    c('observation'), startDates,
                                    leadtimemin = 1,
                                    leadtimemax = 4,
                                    output = 'lonlat',
                                    latmin = 27, latmax = 48,
                                    lonmin = -12, lonmax = 40)
}
ano <- Ano_CrossValid(sampleData$mod, sampleData$obs)
ano <- MeanDims(ano$ano_exp, 2)[1, , 1, , ]
names(dim(ano)) <- c('time', 'lat', 'lon')
eof <- EOF(ano, sampleData$lat, sampleData$lon)
\dontrun{
PlotEquiMap(eof$EOFs[1, , ], sampleData$lon, sampleData$lat)
}

}
\seealso{
ProjectField, NAO, PlotBoxWhisker
}

