@BeginModule
@Name      = EcaCwfi
@Title     = Cold-spell days index wrt 10th percentile of reference period
@Section   = Climate indices
@Class     = Climate index
@Arguments = ifile1 ifile2 ofile
@Operators = eca_cwfi

@BeginDescription
Let @file{ifile1} be a time series of the daily mean temperature TG, and @file{ifile2} be the 10th
percentile TGn10 of daily mean temperatures for any period used as reference. 
Then counted is the number of days where, in intervals of at least @math{nday} consecutive days,
TG < TGn10. The number @math{nday} is an optional parameter with default @math{nday} = 6.
A further output variable is the number of cold-spell periods longer than or equal to @math{nday} days.
TGn10 is calculated as the 10th percentile of daily mean temperatures of a five day window 
centred on each calendar day of a given climate reference period. Note that both TG and TGn10 
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_cwfi
@Title     = Cold-spell days index wrt 10th percentile of reference period
@Parameter = [nday]
@EndOperator


@BeginParameter
@Item = nday
INTEGER  Number of consecutive days (default: nday = 6)
@EndParameter


@BeginExample
To compute the number of cold-spell days of a time series of daily mean temperatures use:
@BeginVerbatim
   cdo eca_cwfi tgfile tgn10file ofile
@EndVerbatim
@EndExample
