@BeginModule
@NewPage
@Name      = Comp
@Title     = Comparison of two fields
@Section   = Comparison
@Class     = Comparison
@Arguments = ifile1 ifile2 ofile
@Operators = eq  ne  le  lt  ge  gt

@BeginDescription
This module compares two datasets field by field. The resulting
field is a mask with 1 if the comparison is true and 0 if the
comparison is false. The type of the comparison depends on the
actual operator.
@EndDescription
@EndModule


@BeginOperator_eq
@Title     = Equal

@BeginDescription
@IfMan
          /   1   if i_1(t,x) EQ i_2(t,x)  AND  i_1(t,x),i_2(t,x) NE miss
o(t,x) = <    0   if i_1(t,x) NE i_2(t,x)  AND  i_1(t,x),i_2(t,x) NE miss
          \  miss if i_1(t,x) EQ miss      OR   i_2(t,x) EQ miss
@EndifMan
@IfDoc
@BeginMath
o(t,x) = \left\{
\begin{array}{cll}
  1   & \mbox{if} \;\; i_1(t,x) = i_2(t,x)    & \wedge \;\; i_1(t,x), i_2(t,x) \neq \mbox{miss}  \\
  0   & \mbox{if} \;\; i_1(t,x) \neq i_2(t,x) & \wedge \;\; i_1(t,x), i_2(t,x) \neq \mbox{miss}  \\
 \mbox{miss} & \mbox{if} \;\; i_1(t,x) = \mbox{miss} & \vee   \;\; i_2(t,x) = \mbox{miss}        \\
\end{array}   \right.
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_ne
@Title     = Not equal

@BeginDescription
@IfMan
          /   1   if i_1(t,x) NE i_2(t,x)  AND  i_1(t,x),i_2(t,x) NE miss
o(t,x) = <    0   if i_1(t,x) EQ i_2(t,x)  AND  i_1(t,x),i_2(t,x) NE miss
          \  miss if i_1(t,x) EQ miss      OR   i_2(t,x) EQ miss
@EndifMan
@IfDoc
@BeginMath
o(t,x) = \left\{
\begin{array}{cll}
  1   & \mbox{if} \;\; i_1(t,x) \neq i_2(t,x) & \wedge \;\; i_1(t,x), i_2(t,x) \neq \mbox{miss}  \\
  0   & \mbox{if} \;\; i_1(t,x) = i_2(t,x)    & \wedge \;\; i_1(t,x), i_2(t,x) \neq \mbox{miss}  \\
 \mbox{miss} & \mbox{if} \;\; i_1(t,x) = \mbox{miss} & \vee   \;\; i_2(t,x) = \mbox{miss}        \\
\end{array}   \right.
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_le
@Title     = Less equal

@BeginDescription
@IfMan
          /   1   if i_1(t,x) LE i_2(t,x)  AND  i_1(t,x),i_2(t,x) NE miss
o(t,x) = <    0   if i_1(t,x) GT i_2(t,x)  AND  i_1(t,x),i_2(t,x) NE miss
          \  miss if i_1(t,x) EQ miss      OR   i_2(t,x) EQ miss
@EndifMan
@IfDoc
@BeginMath
o(t,x) = \left\{
\begin{array}{cll}
  1   & \mbox{if} \;\; i_1(t,x) \leq i_2(t,x) & \wedge \;\; i_1(t,x), i_2(t,x) \neq \mbox{miss}  \\
  0   & \mbox{if} \;\; i_1(t,x) > i_2(t,x)    & \wedge \;\; i_1(t,x), i_2(t,x) \neq \mbox{miss}  \\
 \mbox{miss} & \mbox{if} \;\; i_1(t,x) = \mbox{miss} & \vee   \;\; i_2(t,x) = \mbox{miss}        \\
\end{array}   \right.
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_lt
@Title     = Less than

@BeginDescription
@IfMan
          /   1   if i_1(t,x) LT i_2(t,x)  AND  i_1(t,x),i_2(t,x) NE miss
o(t,x) = <    0   if i_1(t,x) GE i_2(t,x)  AND  i_1(t,x),i_2(t,x) NE miss
          \  miss if i_1(t,x) EQ miss      OR   i_2(t,x) EQ miss
@EndifMan
@IfDoc
@BeginMath
o(t,x) = \left\{
\begin{array}{cll}
  1   & \mbox{if} \;\; i_1(t,x) < i_2(t,x)    & \wedge \;\; i_1(t,x), i_2(t,x) \neq \mbox{miss}  \\
  0   & \mbox{if} \;\; i_1(t,x) \geq i_2(t,x) & \wedge \;\; i_1(t,x), i_2(t,x) \neq \mbox{miss}  \\
 \mbox{miss} & \mbox{if} \;\; i_1(t,x) = \mbox{miss} & \vee   \;\; i_2(t,x) = \mbox{miss}        \\
\end{array}   \right.
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_ge
@Title     = Greater equal

@BeginDescription
@IfMan
          /   1   if i_1(t,x) GE i_2(t,x)  AND  i_1(t,x),i_2(t,x) NE miss
o(t,x) = <    0   if i_1(t,x) LT i_2(t,x)  AND  i_1(t,x),i_2(t,x) NE miss
          \  miss if i_1(t,x) EQ miss      OR   i_2(t,x) EQ miss
@EndifMan
@IfDoc
@BeginMath
o(t,x) = \left\{
\begin{array}{cll}
  1   & \mbox{if} \;\; i_1(t,x) \geq i_2(t,x) & \wedge \;\; i_1(t,x), i_2(t,x) \neq \mbox{miss}  \\
  0   & \mbox{if} \;\; i_1(t,x) < i_2(t,x)    & \wedge \;\; i_1(t,x), i_2(t,x) \neq \mbox{miss}  \\
 \mbox{miss} & \mbox{if} \;\; i_1(t,x) = \mbox{miss} & \vee   \;\; i_2(t,x) = \mbox{miss}        \\
\end{array}   \right.
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginOperator_gt
@Title     = Greater than

@BeginDescription
@IfMan
          /   1   if i_1(t,x) GT i_2(t,x)  AND  i_1(t,x),i_2(t,x) NE miss
o(t,x) = <    0   if i_1(t,x) LE i_2(t,x)  AND  i_1(t,x),i_2(t,x) NE miss
          \  miss if i_1(t,x) EQ miss      OR   i_2(t,x) EQ miss
@EndifMan
@IfDoc
@BeginMath
o(t,x) = \left\{
\begin{array}{cll}
  1   & \mbox{if} \;\; i_1(t,x) > i_2(t,x)    & \wedge \;\; i_1(t,x), i_2(t,x) \neq \mbox{miss}  \\
  0   & \mbox{if} \;\; i_1(t,x) \leq i_2(t,x) & \wedge \;\; i_1(t,x), i_2(t,x) \neq \mbox{miss}  \\
 \mbox{miss} & \mbox{if} \;\; i_1(t,x) = \mbox{miss} & \vee   \;\; i_2(t,x) = \mbox{miss}        \\
\end{array}   \right.
@EndMath
@EndifDoc
@EndDescription
@EndOperator


@BeginExample
To create a mask with 1 if the elements of two fields are the same and 
0 if the elements are different, use:
@BeginVerbatim
   cdo eq ifile1 ifile2 ofile
@EndVerbatim
@EndExample
