@BeginModule
@NewPage
@Name      = Fldstat
@Title     = Statistical values over a field
@Section   = Statistical values
@Class     = Statistic
@Arguments = ifile ofile
@Operators = fldmin fldmax fldsum fldmean fldavg fldstd fldstd1 fldvar fldvar1 fldpctl

@BeginDescription
This module computes statistical values of the input fields. According to the chosen 
operator the field minimum, maximum, sum, average, variance, standard deviation or 
a certain percentile is written to @file{ofile}.
@EndDescription
@EndModule


@BeginOperator_fldmin
@Title     = Field minimum

@BeginDescription
@IfMan
For every gridpoint x_1, ..., x_n of the same field it is:

o(t,1) = min{i(t,x'), x_1<x'<=x_n}
@EndifMan
@IfDoc
For every gridpoint \begin{math}x_1, ..., x_n\end{math} of the same field it is: \\
@BeginMath
o(t,1) = \mbox{\bf min}\{i(t,x'), x_1 < x' \leq x_n\}
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_fldmax
@Title     = Field maximum

@BeginDescription
@IfMan
For every gridpoint x_1, ..., x_n of the same field it is:

o(t,1) = max{i(t,x'), x_1<x'<=x_n}
@EndifMan
@IfDoc
For every gridpoint \begin{math}x_1, ..., x_n\end{math} of the same field it is: \\
@BeginMath
o(t,1) = \mbox{\bf max}\{i(t,x'), x_1 < x' \leq x_n\}
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_fldsum
@Title     = Field sum

@BeginDescription
@IfMan
For every gridpoint x_1, ..., x_n of the same field it is:

o(t,1) = sum{i(t,x'), x_1<x'<=x_n}
@EndifMan
@IfDoc
For every gridpoint \begin{math}x_1, ..., x_n\end{math} of the same field it is: \\
@BeginMath
o(t,1) = \mbox{\bf sum}\{i(t,x'), x_1 < x' \leq x_n\}
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_fldmean
@Title     = Field mean

@BeginDescription
@IfMan
For every gridpoint x_1, ..., x_n of the same field it is:

o(t,1) = mean{i(t,x'), x_1<x'<=x_n}
@EndifMan
@IfDoc
For every gridpoint \begin{math}x_1, ..., x_n\end{math} of the same field it is: \\
@BeginMath
o(t,1) = \mbox{\bf mean}\{i(t,x'), x_1 < x' \leq x_n\}
@EndMath
@EndifDoc
weighted by area weights obtained by the input field.
@EndDescription
@EndOperator


@BeginOperator_fldavg
@Title     = Field average

@BeginDescription
@IfMan
For every gridpoint x_1, ..., x_n of the same field it is:

o(t,1) = avg{i(t,x'), x_1<x'<=x_n}
@EndifMan
@IfDoc
For every gridpoint \begin{math}x_1, ..., x_n\end{math} of the same field it is: \\
@BeginMath
o(t,1) = \mbox{\bf avg}\{i(t,x'), x_1 < x' \leq x_n\}
@EndMath
@EndifDoc
weighted by area weights obtained by the input field.
@EndDescription
@EndOperator


@BeginOperator_fldvar
@Title     = Field variance

@BeginDescription
@IfMan
Normalize by n. For every gridpoint x_1, ..., x_n of the same field it is:

o(t,1) = var{i(t,x'), x_1<x'<=x_n}
@EndifMan
@IfDoc
Normalize by n. For every gridpoint \begin{math}x_1, ..., x_n\end{math} of the same field it is: \\
@BeginMath
o(t,1) = \mbox{\bf var}\{i(t,x'), x_1 < x' \leq x_n\}
@EndMath
@EndifDoc
weighted by area weights obtained by the input field.
@EndDescription
@EndOperator


@BeginOperator_fldvar1
@Title     = Field variance (n-1)

@BeginDescription
@IfMan
Normalize by (n-1). For every gridpoint x_1, ..., x_n of the same field it is:

o(t,1) = var1{i(t,x'), x_1<x'<=x_n}
@EndifMan
@IfDoc
Normalize by (n-1). For every gridpoint \begin{math}x_1, ..., x_n\end{math} of the same field it is: \\
@BeginMath
o(t,1) = \mbox{\bf var1}\{i(t,x'), x_1 < x' \leq x_n\}
@EndMath
@EndifDoc
weighted by area weights obtained by the input field.
@EndDescription
@EndOperator


@BeginOperator_fldstd
@Title     = Field standard deviation

@BeginDescription
@IfMan
Normalize by n. For every gridpoint x_1, ..., x_n of the same field it is:

o(t,1) = std{i(t,x'), x_1<x'<=x_n}
@EndifMan
@IfDoc
Normalize by n. For every gridpoint \begin{math}x_1, ..., x_n\end{math} of the same field it is: \\
@BeginMath
o(t,1) = \mbox{\bf std}\{i(t,x'), x_1 < x' \leq x_n\}
@EndMath
@EndifDoc
weighted by area weights obtained by the input field.
@EndDescription
@EndOperator


@BeginOperator_fldstd1
@Title     = Field standard deviation (n-1)

@BeginDescription
@IfMan
Normalize by (n-1). For every gridpoint x_1, ..., x_n of the same field it is:

o(t,1) = std1{i(t,x'), x_1<x'<=x_n}
@EndifMan
@IfDoc
Normalize by (n-1). For every gridpoint \begin{math}x_1, ..., x_n\end{math} of the same field it is: \\
@BeginMath
o(t,1) = \mbox{\bf std1}\{i(t,x'), x_1 < x' \leq x_n\}
@EndMath
@EndifDoc
weighted by area weights obtained by the input field.
@EndDescription
@EndOperator


@BeginOperator_fldpctl
@Title     = Field percentiles
@Parameter = p

@BeginDescription
@IfMan
For every gridpoint x_1, ..., x_n of the same field it is:

o(t,1) = pth percentile {i(t,x'), x_1<x'<=x_n}
@EndifMan
@IfDoc
For every gridpoint \begin{math}x_1, ..., x_n\end{math} of the same field it is: \\
@BeginMath
o(t,1) = \mbox{\bf pth percentile} \{i(t,x'), x_1 < x' \leq x_n\}
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginParameter
@Item = p
FLOAT  Percentile number in {0, ..., 100}
@EndParameter


@c @BeginNote
@c Use CDO option '-v' in order to print the geographic position of the
@c minimum and maximum to stdout.
@c @EndNote


@BeginExample
To compute the field mean of all input fields use:
@BeginVerbatim
   cdo fldmean ifile ofile
@EndVerbatim

To compute the 90th percentile of all input fields use:
@BeginVerbatim
   cdo fldpctl,90 ifile ofile
@EndVerbatim
@EndExample
