@BeginModule
@NewPage
@Name      = Runpctl
@Title     = Running percentile values
@Section   = Statistical values
@Class     = Statistic
@Arguments = ifile1 ofile
@Operators = runpctl

@BeginDescription
This module computes running percentiles over a selected number of time
steps in @file{ifile1}.
The date information in @file{ofile} is the date of the medium contributing
time step in @file{ifile1}.
@EndDescription
@EndModule


@BeginOperator_runpctl
@Title     = Running percentiles
@Parameter = p nts

@BeginDescription
@IfMan
o(t+(nts-1)/2,x) = pth percentile {i(t,x), i(t+1,x), ..., i(t+nts-1,x)}
@EndifMan
@IfDoc
@BeginMath
o(t+(nts-1)/2,x) = \mbox{\bf pth percentile} \{i(t,x), i(t+1,x), ..., i(t+nts-1,x)\}
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginParameter
@Item = p
INTEGER  Percentile number in {1, ..., 99}
@Item = nts
INTEGER  Number of time steps
@EndParameter


@BeginExample
To compute the running 50th percentile (median) over 9 time steps, use:
@BeginVerbatim
   cdo runpctl,50,9 ifile -runmin,9 ifile -runmax,9 ifile ofile
@EndVerbatim
@EndExample
