@BeginModule
@NewPage
@Name      = Diff
@Title     = Compare two datasets field by field
@Section   = Information
@Class     = Information
@Arguments = ifile1 ifile2
@Operators = diff diffv

@BeginDescription
Compares the contents of two datasets field by field. The input
datasets need to have the same structure and its fields need to have 
the same header information and dimensions.
@EndDescription
@EndModule


@BeginOperator_diff
@Title     = Compare two datasets listed by code number

@BeginDescription
Provides statistics on differences between two datasets.
For each pair of fields the operator prints one line with the following information:
@BeginItemize
@Item = Date and Time
@Item = Code number and Level
@Item = Size of the grid and number of Missing values
@Item = Occurrence of coefficient pairs with different signs (S)
@Item = Occurrence of zero values (Z)
@Item = Maxima of absolute difference of coefficient pairs
@Item = Maxima of relative difference of non-zero coefficient pairs with equal signs
@EndItemize
@IfDoc
\begin{displaymath}
        Absdiff(t,x) = \left| i_1(t,x) - i_2(t,x) \right|
\end{displaymath}
\begin{displaymath}
        Reldiff(t,x) = \frac{\left| i_1(t,x) - i_2(t,x) \right|}{\mbox{max}(\left| i_1(t,x) \right| , \left| i_2(t,x) \right| )}
\end{displaymath}
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_diffv
@Title     = Compare two datasets listed by variable name

@BeginDescription
The same as operator @oper{diff}. Using the name instead of the code number
to identify the variable.
@EndDescription
@EndOperator


@BeginExample
To print the difference for each field of two datasets use:
@BeginVerbatim
   cdo diffv ifile1 ifile2
@EndVerbatim
This is an example result of two datasets with one 2D variable over 12 time steps:
@BeginVerbatim
             Date  Time  Varname Level Size  Miss : S Z Max_Absdiff Max_Reldiff
   1 : 1987-01-31 12:00:00 SST      0  2048  1361 : F F  0.00010681  4.1660e-07
   2 : 1987-02-28 12:00:00 SST      0  2048  1361 : F F  6.1035e-05  2.3742e-07
   3 : 1987-03-31 12:00:00 SST      0  2048  1361 : F F  7.6294e-05  3.3784e-07
   4 : 1987-04-30 12:00:00 SST      0  2048  1361 : F F  7.6294e-05  3.5117e-07
   5 : 1987-05-31 12:00:00 SST      0  2048  1361 : F F  0.00010681  4.0307e-07
   6 : 1987-06-30 12:00:00 SST      0  2048  1361 : F F  0.00010681  4.2670e-07
   7 : 1987-07-31 12:00:00 SST      0  2048  1361 : F F  9.1553e-05  3.5634e-07
   8 : 1987-08-31 12:00:00 SST      0  2048  1361 : F F  7.6294e-05  2.8849e-07
   9 : 1987-09-30 12:00:00 SST      0  2048  1361 : F F  7.6294e-05  3.6168e-07
  10 : 1987-10-31 12:00:00 SST      0  2048  1361 : F F  9.1553e-05  3.5001e-07
  11 : 1987-11-30 12:00:00 SST      0  2048  1361 : F F  6.1035e-05  2.3839e-07
  12 : 1987-12-31 12:00:00 SST      0  2048  1361 : F F  9.3553e-05  3.7624e-07
@EndVerbatim
@EndExample
