\section{Missing values}

All operators can handle missing values.
The default missing value for GRIB, SERVICE, EXTRA and IEG files is $-9e+33$. 
The {\CDO} option '-m $<$missval$>$' overwrites the default missing value.
In netCDF files the variable attribute '\_FillValue' is used as a missing value.
The operator '\htmlref{setmissval}{setmissval}' can be used to set a new missing value.

The {\CDO} use of the missing value is shown in the following tables,
where one table is printed for each operation.
The operations are applied to arbitrary numbers $a$, $b$, the special case $0$,
and the missing value $miss$.
%Gray fields are of particular interest.
For example the table named "addition" shows that the sum of an
arbitrary number $a$ and the missing value is the missing value,
and the table named "multiplication" shows that $0$ multiplied by missing
value results in $0$.

\hspace{2cm}
\vspace{2mm}
\begin{minipage}[t]{8cm}

\begin{tabular}[t]{|c||c|c|}
\hline
\makebox[2.3cm]{\bf addition}&  \makebox[2cm]{\bf b} & \makebox[2cm]{\bf miss} \\
\hline
\hline
   {\bf a}        &       $a + b$   &    $miss$ \\
\hline
  {\bf miss}      &       $miss$    &    $miss$ \\
\hline
\end{tabular}

\vspace{1mm}

\begin{tabular}[t]{|c||c|c|}
\hline
\makebox[2.3cm]{\bf subtraction}&  \makebox[2cm]{\bf b} & \makebox[2cm]{\bf miss} \\
\hline
\hline
   {\bf a}        &       $a - b$   &    $miss$ \\
\hline
  {\bf miss}      &       $miss$    &    $miss$ \\
\hline
\end{tabular}

\vspace{1mm}

\begin{tabular}[b]{|c||c|c|c|}
\hline
\makebox[2.3cm]{\bf multiplication} & \makebox[2cm]{\bf b} & \makebox[2cm]{\bf 0} & \makebox[2cm]{\bf miss} \\
\hline
\hline
   {\bf a}        &       $a * b$   &     $0$   &    $miss$ \\
\hline
   {\bf 0}        &        $0$      &     $0$   &     $0$   \\
\hline
  {\bf miss}      &       $miss$    &     $0$   &    $miss$ \\
\hline
\end{tabular}

\vspace{1mm}

\begin{tabular}[b]{|c||c|c|c|}
\hline
\makebox[2.3cm]{\bf division} & \makebox[2cm]{\bf b} & \makebox[2cm]{\bf 0} & \makebox[2cm]{\bf miss} \\
\hline
\hline
   {\bf a}        &       $a / b$   &    $miss$ &    $miss$ \\
\hline
   {\bf 0}        &        $0$      &    $miss$ &    $miss$ \\
\hline
  {\bf miss}      &       $mis$s    &    $miss$ &    $miss$ \\
\hline
\end{tabular}

\vspace{1mm}

\begin{tabular}[b]{|c||c|c|}
\hline
\makebox[2.3cm]{\bf maximum} & \makebox[2cm]{\bf b} & \makebox[2cm]{\bf miss} \\
\hline
\hline
   {\bf a}        &      $max(a,b)$ &     $a$   \\
\hline
  {\bf miss}      &        $b$      &    $miss$ \\
\hline
\end{tabular}

\vspace{1mm}

\begin{tabular}[b]{|c||c|c|}
\hline
\makebox[2.3cm]{\bf minimum} & \makebox[2cm]{\bf b} & \makebox[2cm]{\bf miss} \\
\hline
\hline
   {\bf a}        &      $min(a,b)$ &     $a$   \\
\hline
  {\bf miss}      &        $b$      &    $miss$ \\
\hline
\end{tabular}

\end{minipage}

\vspace{2mm}

The handling of missing values by the operations "minimum" and "maximum" may
be surprising, but the definition given here is more consistent with that
expected in practice. Mathematical functions (e.g. $log$, $sqrt$, etc.)
return the missing value if an argument is the missing value or
an argument is out of range.

All statistical functions ignore missing values, treading them as not belonging
to the sample, with the side-effect of a reduced sample size.

\subsection{Mean and average}

An artificial distinction is made between the notions mean and average.
The mean is regarded as a statistical function, whereas the average is found simply
by adding the sample members and dividing the result by the sample size.
For example, the mean of 1, 2, $miss$ and 3 is $(1+2+3)/3=2$,
whereas the average is $(1+2+miss+3)/4=miss/4=miss$.
If there are no missing values in the sample, the average and mean are identical.
