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

@BeginDescription
This module computes running percentiles over a selected number of timesteps in @file{ifile}.
The time stamp in @file{ofile} is from the middle contributing timestep of @file{ifile}.
@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
