@BeginModule
@NewPage
@Name      = Ydrunstat
@Title     = Multi-year daily running statistical values
@Section   = Statistical values
@Class     = Statistic
@Arguments = ifile ofile
@Operators = ydrunmin ydrunmax ydrunsum ydrunmean ydrunavg ydrunstd

@BeginDescription
This module writes to @file{ofile} running statistical values for each
day of year in @file{ifile}. Depending on the actual operator, the minimum,
maximum, sum, average or standard deviation of all time steps in those
running windows whose medium time steps correspond to the same day of year
is computed. The date information in an output field is the date of the
last contributing input field.
@EndModule


@BeginOperator_ydrunmin
@Title     = Multi-year daily running minimum
@Parameter = nts

@BeginDescription
@IfMan
o(001,x) = min{i(t,x), i(t+1,x), ..., i(t+nts-1,x); day(t+(nts-1)/2) = 001}
                 ...
o(366,x) = min{i(t,x), i(t+1,x), ..., i(t+nts-1,x); day(t+(nts-1)/2) = 366}
@EndifMan
@IfDoc
@BeginMath
\begin{array}{c}
o(\mbox{001},x) = \mbox{\bf min}\{i(t,x), i(t+1,x), ..., i(t+nts-1,x); \mbox{day}(t+(nts-1)/2) = \mbox{001}\} \\
\vdots \\
o(\mbox{366},x) = \mbox{\bf min}\{i(t,x), i(t+1,x), ..., i(t+nts-1,x); \mbox{day}(t+(nts-1)/2) = \mbox{366}\} \\
\end{array}
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_ydrunmax
@Title     = Multi-year daily running maximum
@Parameter = nts

@BeginDescription
@IfMan
o(001,x) = max{i(t,x), i(t+1,x), ..., i(t+nts-1,x); day(t+(nts-1)/2) = 001}
                 ...
o(366,x) = max{i(t,x), i(t+1,x), ..., i(t+nts-1,x); day(t+(nts-1)/2) = 366}
@EndifMan
@IfDoc
@BeginMath
\begin{array}{c}
o(\mbox{001},x) = \mbox{\bf max}\{i(t,x), i(t+1,x), ..., i(t+nts-1,x); \mbox{day}(t+(nts-1)/2) = \mbox{001}\} \\
\vdots \\
o(\mbox{366},x) = \mbox{\bf max}\{i(t,x), i(t+1,x), ..., i(t+nts-1,x); \mbox{day}(t+(nts-1)/2) = \mbox{366}\} \\
\end{array}
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_ydrunsum
@Title     = Multi-year daily running sum
@Parameter = nts

@BeginDescription
@IfMan
o(001,x) = sum{i(t,x), i(t+1,x), ..., i(t+nts-1,x); day(t+(nts-1)/2) = 001}
                 ...
o(366,x) = sum{i(t,x), i(t+1,x), ..., i(t+nts-1,x); day(t+(nts-1)/2) = 366}
@EndifMan
@IfDoc
@BeginMath
\begin{array}{c}
o(\mbox{001},x) = \mbox{\bf sum}\{i(t,x), i(t+1,x), ..., i(t+nts-1,x); \mbox{day}(t+(nts-1)/2) = \mbox{001}\} \\
\vdots \\
o(\mbox{366},x) = \mbox{\bf sum}\{i(t,x), i(t+1,x), ..., i(t+nts-1,x); \mbox{day}(t+(nts-1)/2) = \mbox{366}\} \\
\end{array}
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_ydrunmean
@Title     = Multi-year daily running mean
@Parameter = nts

@BeginDescription
@IfMan
o(001,x) = mean{i(t,x), i(t+1,x), ..., i(t+nts-1,x); day(t+(nts-1)/2) = 001}
                 ...
o(366,x) = mean{i(t,x), i(t+1,x), ..., i(t+nts-1,x); day(t+(nts-1)/2) = 366}
@EndifMan
@IfDoc
@BeginMath
\begin{array}{c}
o(\mbox{001},x) = \mbox{\bf mean}\{i(t,x), i(t+1,x), ..., i(t+nts-1,x); \mbox{day}(t+(nts-1)/2) = \mbox{001}\} \\
\vdots \\
o(\mbox{366},x) = \mbox{\bf mean}\{i(t,x), i(t+1,x), ..., i(t+nts-1,x); \mbox{day}(t+(nts-1)/2) = \mbox{366}\} \\
\end{array}
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_ydrunavg
@Title     = Multi-year daily running average
@Parameter = nts

@BeginDescription
@IfMan
o(001,x) = avg{i(t,x), i(t+1,x), ..., i(t+nts-1,x); day(t+(nts-1)/2) = 001}
                 ...
o(366,x) = avg{i(t,x), i(t+1,x), ..., i(t+nts-1,x); day(t+(nts-1)/2) = 366}
@EndifMan
@IfDoc
@BeginMath
\begin{array}{c}
o(\mbox{001},x) = \mbox{\bf avg}\{i(t,x), i(t+1,x), ..., i(t+nts-1,x); \mbox{day}(t+(nts-1)/2) = \mbox{001}\} \\
\vdots \\
o(\mbox{366},x) = \mbox{\bf avg}\{i(t,x), i(t+1,x), ..., i(t+nts-1,x); \mbox{day}(t+(nts-1)/2) = \mbox{366}\} \\
\end{array}
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_ydrunstd
@Title     = Multi-year daily running standard deviation
@Parameter = nts

@BeginDescription
@IfMan
o(001,x) = std{i(t,x), i(t+1,x), ..., i(t+nts-1,x); day(t+(nts-1)/2) = 001}
                 ...
o(366,x) = std{i(t,x), i(t+1,x), ..., i(t+nts-1,x); day(t+(nts-1)/2) = 366}
@EndifMan
@IfDoc
@BeginMath
\begin{array}{c}
o(\mbox{001},x) = \mbox{\bf std}\{i(t,x), i(t+1,x), ..., i(t+nts-1,x); \mbox{day}(t+(nts-1)/2) = \mbox{001}\} \\
\vdots \\
o(\mbox{366},x) = \mbox{\bf std}\{i(t,x), i(t+1,x), ..., i(t+nts-1,x); \mbox{day}(t+(nts-1)/2) = \mbox{366}\} \\
\end{array}
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginParameter
@Item = nts
INTEGER  Number of time steps
@EndParameter


@BeginExample
Assume the input data provide daily measurements. To compute the daily mean
over all input years for a running window of five days, use:
@BeginVerbatim
   cdo ydrunmean,5 ifile ofile
@EndVerbatim
Note that except for the standard deviation the result of the operators in
this module is equivalent to a composition of corresponding operators from
the @mod{YDAYSTAT} and @mod{RUNSTAT} modules. For instance, the above command yields the
same result as:
@BeginVerbatim
   cdo ydaymean -runmean,5 ifile ofile
@EndVerbatim
@EndExample
