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

@BeginDescription
This module computes statistical values of the input fields.
According to the actual 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
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
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_fldstd
@Title     = Field standard deviation

@BeginDescription
@IfMan
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
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_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
INTEGER  Percentile number in {1, ..., 99}
@EndParameter


@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
