@BeginModule
@NewPage
@Name      = Ydaypctl
@Title     = Multi-year daily percentile values
@Section   = Statistical values
@Class     = Statistic
@Arguments = ifile1 ifile2 ifile3 ofile
@Operators = ydaypctl

@BeginDescription
This module writes to @file{ofile} a certain percentile of each day of
year in @file{ifile1}.
The algorithm uses histograms with minimum and maximum bounds given in
@file{ifile2} and @file{ifile3}, respectively. The default number of
histogram bins is 100. The default can be overridden by setting the
environment variable CDO_PCTL_NBINS to a different value. The files
@file{ifile2} and @file{ifile3} must be the result of corresponding
ydaymin and ydaymax operations, respectively.
The date information in an output field is the date of the last
contributing input field.
@EndModule


@BeginOperator_ydaypctl
@Title     = Multi-year daily percentiles
@Parameter = p

@BeginDescription
@IfMan
o(001,x) = pth percentile {i(t,x), day(i(t)) = 001}
                 ...
o(366,x) = pth percentile {i(t,x), day(i(t)) = 366}
@EndifMan
@IfDoc
@BeginMath
\begin{array}{c}
o(\mbox{001},x) = \mbox{\bf pth percentile} \{i(t,x), \mbox{day}(i(t)) = \mbox{001}\} \\
\vdots \\
o(\mbox{366},x) = \mbox{\bf pth percentile} \{i(t,x), \mbox{day}(i(t)) = \mbox{366}\} \\
\end{array}
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginParameter
@Item = p
INTEGER  Percentile number in {1, ..., 99}
@EndParameter


@BeginExample
To compute the daily 90th percentile over all input years, use:
@BeginVerbatim
   cdo ydaymin ifile minfile
   cdo ydaymax ifile maxfile
   cdo ydaypctl,90 ifile minfile maxfile ofile
@EndVerbatim
Or shorter using operator piping:
@BeginVerbatim
   cdo ydaypctl,90 ifile -ydaymin ifile -ydaymax ifile ofile
@EndVerbatim
@EndExample
