@BeginModule
@NewPage
@Name      = Timpctl
@Title     = Percentile values over all timesteps
@Section   = Statistical values
@Class     = Statistic
@Arguments = ifile1 ifile2 ifile3 ofile
@Operators = timpctl

@BeginDescription
This operator computes percentiles over all timesteps 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 101. The default can be overridden by setting the
environment variable @env{CDO_PCTL_NBINS} to a different value. The files @file{ifile2} and @file{ifile3}
should be the result of corresponding @mod{timmin} and @mod{timmax} operations, respectively.
The date information of a timestep in @file{ofile} is the date of the last contributing 
timestep in @file{ifile1}.
@EndDescription
@EndModule


@BeginOperator_timpctl
@Title     = Time percentiles
@Parameter = p

@BeginDescription
@IfMan

o(1,x) = pth percentile {i(t',x), t_1<t'<=t_n}
@EndifMan
@IfDoc
\vspace*{5mm}
@BeginMath
o(1,x) = \mbox{\bf pth percentile} \{i(t',x), t_1 < t' \leq t_n\}
@EndMath
@EndifDoc
@EndDescription
@EndOperator


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


@BeginEnvironment
@Item = CDO_PCTL_NBINS
Sets the number of histogram bins. The default number is 101.
@EndEnvironment


@BeginExample
To compute the 90th percentile over all input timesteps use:
@BeginVerbatim
   cdo timmin ifile minfile
   cdo timmax ifile maxfile
   cdo timpctl,90 ifile minfile maxfile ofile
@EndVerbatim
Or shorter using operator piping:
@BeginVerbatim
   cdo timpctl,90 ifile -timmin ifile -timmax ifile ofile
@EndVerbatim
@EndExample
