@BeginModule
@NewPage
@Name      = Eofcoeff
@Title     = Principal coefficients of EOFs
@Section   = EOFs
@Class     = Eof coefficients
@Arguments = ifile1 ifile2 obase
@Operators = eofcoeff

@BeginDescription
This module calculates the time series of the principal coefficients for given EOF
(empirical orthogonal functions) and data. Time steps in @file{ifile1} are 
assumed to be the EOFs, Time steps in @file{ifile2} are assumed to be the
time series. Weights are taken into account, which is why EOF output is @bold{not} weighted. 
Note, that this operator calculates a weighted dot product of the fields in
@file{ifile1} and @file{ifile2}.
@IfDoc
Given a set of EOFs @math{e_j} and a time series of data @math{z(t)} 
with @math{p} entries for each timestep from which @math{e_j} have been calculated, this 
operator calculates the time series of the projections of data onto each EOF
@BeginDisplayMath
o_j(t) = \sum_{x=1}^{p} W(x,x) z(t,x)e_j(x)
@EndDisplayMath
where @math{W} is the diagonal matrix containing area weights as above. 
There will be a seperate file @math{o_j} for the principal coefficients of each EOF.

As the EOFs @math{e_j} are uncorrelated, so are their principal coefficients, i.e.
@BeginDisplayMath
\sum_{t=1}^{n} o_j(t)o_k(t) = \left\{\begin{array}{l} 0~if~j\ne k\\ \lambda_j~if~j=k\end{array}\right.
with~\sum_{t=1}^{n}o_j(t)=0\forall j\in\{1,\ldots,p\}.
@EndDisplayMath
@EndifDoc

There will be a separate file containing a time series of principal coefficients
with time information from @file{ifile2} for each EOF in @file{ifile1}. Output files
will be numbered as @file{<obase><neof><suffix>} where @file{neof+1} is the number of the
EOF (timestep) in @file{ifile1} and @file{suffix} is the filename extension derived from the file format. 
@EndDescription
@EndModule


@BeginOperator_eofcoeff
@Title     = Calculate principal coefficients of EOFs
@EndOperator


@BeginEnvironment
@Item = CDO_FILE_SUFFIX
This environment variable can be used to set the default file suffix. This suffix will be
added to the output file names instead of the filename extension derived from the file format. 
Set this variable to NULL to disable the adding of a file suffix.
@EndEnvironment


@BeginExample
To calculate principal coefficients of the first 40 EOFs of @file{anom\_file}, 
and write them to files beginning with obase, use:
@BeginVerbatim
   cdo eof,40 anom_file eval_file eof_file
   cdo eofcoeff eof_file anom_file obase
@EndVerbatim
The principal coefficients of the first EOF will be in the file
@file{obase000000.nc} (and so forth for higher EOFs, 
@math{n}th EOF will be in @file{obase<n-1>}).

If the dataset @file{ifile} does not containt anomalies, process them first,
and use:
@BeginVerbatim
   cdo sub ifile -timmean ifile anom_file	
   cdo eof,40 anom_file eval_file eof_file
   cdo eofcoeff eof_file anom_file obase	
@EndVerbatim
@EndExample
