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

@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 parameter id

@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 = Level, Gridsize and number of Missing values
@Item = Number of different 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
@Item = Parameter identifier
@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_diffn
@Title     = Compare two datasets listed by parameter name

@BeginDescription
The same as operator @oper{diff}. Using the name instead of the
identifier to label the parameter.
@EndDescription
@EndOperator


@BeginExample
To print the difference for each field of two datasets use:
@BeginVerbatim
   cdo diffn ifile1 ifile2
@EndVerbatim
This is an example result of two datasets with one 2D parameter over 12 timesteps:
@BeginListing
           Date   Time Level Size Miss Diff : S Z Max_Absdiff Max_Reldiff : Name  
 1 : 1987-01-31 12:00:00   0 2048 1361  273 : F F  0.00010681  4.1660e-07 : SST   
 2 : 1987-02-28 12:00:00   0 2048 1361  309 : F F  6.1035e-05  2.3742e-07 : SST   
 3 : 1987-03-31 12:00:00   0 2048 1361  292 : F F  7.6294e-05  3.3784e-07 : SST   
 4 : 1987-04-30 12:00:00   0 2048 1361  183 : F F  7.6294e-05  3.5117e-07 : SST   
 5 : 1987-05-31 12:00:00   0 2048 1361  207 : F F  0.00010681  4.0307e-07 : SST   
 7 : 1987-07-31 12:00:00   0 2048 1361  317 : F F  9.1553e-05  3.5634e-07 : SST   
 8 : 1987-08-31 12:00:00   0 2048 1361  219 : F F  7.6294e-05  2.8849e-07 : SST   
 9 : 1987-09-30 12:00:00   0 2048 1361  188 : F F  7.6294e-05  3.6168e-07 : SST   
10 : 1987-10-31 12:00:00   0 2048 1361  297 : F F  9.1553e-05  3.5001e-07 : SST   
11 : 1987-11-30 12:00:00   0 2048 1361  234 : F F  6.1035e-05  2.3839e-07 : SST   
12 : 1987-12-31 12:00:00   0 2048 1361  267 : F F  9.3553e-05  3.7624e-07 : SST
11 of 12 records differ
@EndListing
@EndExample
