@BeginModule
@Name      = Cond2
@Title     = Conditional select  two fields
@Section   = Conditional selection
@Arguments = ifile1 ifile2 ifile3 ofile
@Operators = ifthenelse

@BeginDescription
This operator conditional selects field elements from @file{ifile2} or @file{ifile3} and 
writes them to @file{ofile}. The fields in @file{ifile1} are handled as a mask.
A value not equal to zero is treated as "true", zero is treated as "false".
@EndDescription
@EndModule


@BeginOperator_ifthenelse
@Title     = If then else

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


@BeginExample
To select all field elements of @file{ifile2} if the corresponding field
element of @file{ifile1} is greater than 0 and from @file{ifile3} otherwise, use:
@BeginVerbatim
   cdo ifthenelse ifile1 ifile2 ifile3 ofile
@EndVerbatim
@EndExample
