@BeginModule
@NewPage
@Name      = EcaCwdi
@Title     = Cold wave duration index wrt mean of reference period
@Section   = Climate indices
@Class     = Climate index
@Arguments = ifile1 ifile2 ofile
@Operators = eca_cwdi

@BeginDescription
Let @file{ifile1} be a time series of the daily minimum temperature TN, and let @file{ifile2} be the mean 
TNnorm of daily minimum temperatures for any period used as reference. Then counted is the number of days
where, in intervals of at least @math{nday} consecutive days, TN < TNnorm - @math{T}.
The numbers @math{nday} and @math{T} are optional parameters with default @math{nday} = 6 and @math{T} = 5@celsius. 
A further output variable is the number of cold waves longer than or equal to @math{nday} days.
TNnorm is calculated as the mean of minimum temperatures of a five day window centred on each calendar day 
of a given climate reference period. Note that both TN and TNnorm have to be given in the same units.
The date information of a timestep in @file{ofile} is the date of the last contributing timestep in @file{ifile1}.
@EndDescription
@EndModule


@BeginOperator_eca_cwdi
@Title     = Cold wave duration index wrt mean of reference period
@Parameter = [nday] [T]
@EndOperator


@BeginParameter
@Item = nday
INTEGER  Number of consecutive days (default: nday = 6)
@Item = T
FLOAT    Temperature offset (unit: @celsius; default: T = 5@celsius)
@EndParameter


@BeginExample
To compute the cold wave duration index of a time series of daily minimum temperatures use:
@BeginVerbatim
   cdo eca_cwdi tnfile tnnormfile ofile
@EndVerbatim
@EndExample
