@BeginModule
@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 timesteps in @file{ifile1}.
The date information in @file{ofile} is the date of the timestep in the middle of the contributing timesteps 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
\vspace*{5mm}
@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
FLOAT    Percentile number in {0, ..., 100}
@Item = nts
INTEGER  Number of timesteps
@EndParameter


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