@BeginModule
@NewPage
@Name      = Selstat
@Title     = Time range statistical values
@Section   = Statistical values
@Class     = Statistic
@Arguments = ifile ofile
@Operators = selmin selmax selsum selmean selavg selstd

@BeginDescription
This module computes statistical values for a selected number of time steps.
According to the actual operator the average, minimum, maximum, sum, average 
or standard deviation of the selected time steps is written to @file{ofile}.
The date information for a time step in @file{ofile} is the date of the last 
contributing time step in @file{ifile}.
@EndDescription
@EndModule


@BeginOperator_selmin
@Title     = Time range minimum
@Parameter = nsets [noffset] [nskip]

@BeginDescription
@IfMan
For every adjacent sequence t1, ...., tn of time steps of the same 
selected time range, it is

o(t,x) = min{i(t',x), t1 < t' <= tn}
@EndifMan
@IfDoc
For every adjacent sequence \begin{math}t_1, ...,t_n\end{math} of timesteps of the same 
selected time range, it is: \\
@BeginMath
o(t,x) = \mbox{\bf min}\{i(t',x), t_1 < t' \le t_n\}
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_selmax
@Title     = Time range maximum
@Parameter = nsets [noffset] [nskip]

@BeginDescription
@IfMan
For every adjacent sequence t1, ...., tn of time steps of the same 
selected time range, it is

o(t,x) = max{i(t',x), t1 < t' <= tn}
@EndifMan
@IfDoc
For every adjacent sequence \begin{math}t_1, ...,t_n\end{math} of timesteps of the same 
selected time range, it is: \\
@BeginMath
o(t,x) = \mbox{\bf max}\{i(t',x), t_1 < t' \le t_n\}
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_selsum
@Title     = Time range sum
@Parameter = nsets [noffset] [nskip]

@BeginDescription
@IfMan
For every adjacent sequence t1, ...., tn of time steps of the same 
selected time range, it is

o(t,x) = sum{i(t',x), t1 < t' <= tn}
@EndifMan
@IfDoc
For every adjacent sequence \begin{math}t_1, ...,t_n\end{math} of timesteps of the same 
selected time range, it is: \\
@BeginMath
o(t,x) = \mbox{\bf sum}\{i(t',x), t_1 < t' \le t_n\}
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_selmean
@Title     = Time range mean
@Parameter = nsets [noffset] [nskip]

@BeginDescription
@IfMan
For every adjacent sequence t1, ...., tn of time steps of the same 
selected time range, it is

o(t,x) = mean{i(t',x), t1 < t' <= tn}
@EndifMan
@IfDoc
For every adjacent sequence \begin{math}t_1, ...,t_n\end{math} of timesteps of the same 
selected time range, it is: \\
@BeginMath
o(t,x) = \mbox{\bf mean}\{i(t',x), t_1 < t' \le t_n\}
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_selavg
@Title     = Time range average
@Parameter = nsets [noffset] [nskip]

@BeginDescription
@IfMan
For every adjacent sequence t1, ...., tn of time steps of the same 
selected time range, it is

o(t,x) = avg{i(t',x), t1 < t' <= tn}
@EndifMan
@IfDoc
For every adjacent sequence \begin{math}t_1, ...,t_n\end{math} of timesteps of the same 
selected time range, it is: \\
@BeginMath
o(t,x) = \mbox{\bf avg}\{i(t',x), t_1 < t' \le t_n\}
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_selstd
@Title     = Time range standard deviation
@Parameter = nsets [noffset] [nskip]

@BeginDescription
@IfMan
For every adjacent sequence t1, ...., tn of time steps of the same 
selected time range, it is

o(t,x) = sqrt{var{i(t',x), t1 < t' <= tn}}
@EndifMan
@IfDoc
For every adjacent sequence \begin{math}t_1, ...,t_n\end{math} of timesteps of the same 
selected time range, it is: \\
@BeginMath
o(t,x) = \mbox{\bf std}\{i(t',x), t_1 < t' \le t_n\}
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginParameter noffset
@Item = nsets
INTEGER  Number of input time steps for each output time step
@Item = noffset
INTEGER  Number of input time steps skipped before the first time step range (optional)
@Item = nskip
INTEGER  Number of input time steps skipped between time step ranges (optional)
@EndParameter


@BeginExample
Assume an input dataset has monthly means over several years.
To compute seasonal means from monthly means the first two
month must be skipped:
@BeginVerbatim
   cdo selmean,3,2 ifile ofile
@EndVerbatim
@EndExample
