@BeginModule
@Name      = EcaHwdi
@Title     = Heat wave duration index wrt mean of reference period
@Section   = Climate indices
@Class     = Climate index
@Arguments = ifile1 ifile2 ofile
@Operators = eca_hwdi

@BeginDescription
Let @file{ifile1} be a time series of daily maximum temperatures TX,
and let @file{ifile2} be the mean TXnorm of daily maximum temperatures
for any period used as reference. Then counted is the number of days
where, in intervals of at least nday consecutive days, TX > TXnorm + T.
The numbers nday and T are optional parameters with default nday = 6
and T = 5° Celsius. A further output variable is the number of heat
waves longer than or equal to nday days. Note that both TX and TXnorm
have to be given in the same units.
The date information of a time step in @file{ofile} is the date of
the last contributing time step in @file{ifile1}.
@EndDescription
@EndModule


@BeginOperator_eca_hwdi
@Title     = Heat 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 (° Celsius, default: T = 5° Celsius)
@EndParameter


@BeginExample
To compute the heat wave duration index of a time series of daily
maximum temperatures use:
@BeginVerbatim
   cdo eca_hwdi txfile txnormfile ofile
@EndVerbatim
@EndExample
