%Every input and output file is a collection of 2D or 3D variables
%over an unlimited number of time steps.

\section{GRIB edition 1}

GRIB \cite{GRIB} (GRIdded Binary) is a standard format designed by the
World Meteorological Organization (WMO) to support the efficient 
transmission and storage of gridded meteorological data.

A GRIB record consists of a series of header sections, followed by
a bitstream of packed data representing one horizontal grid of data
values. The header sections are intended to fully describe the data
included in the bitstream, specifying information such as the
parameter, units, and precision of the data, the grid system and
level type on which the data is provided, and the date and time
for which the data are valid.

Non-numeric descriptors are enumerated in tables, such that a 1-byte
code in a header section refers to a unique description.
The WMO provides a standard set of enumerated parameter names and
level types, but the standard also allows for the definition
of locally used parameters and geometries. Any activity
that generates and distributes GRIB records must also make
their locally defined GRIB tables available to users.

{\CDI} does not support the full GRIB standard. The following
data representation and level types are implemented: \\

\begin{tabular}{rl}
\textbf{Grid type} &  \\
   0  & Latitude/longitude grid \\
   3  & Lambert conformal grid \\
   4  & Gaussian latitude/longitude grid \\
  10  & Rotated latitude/longitude grid \\
  50  & Spherical Harmonic Coefficients \\
 192  & Icosahedral-hexagonal GME grid \\
\end{tabular}


\begin{tabular}{rl}
\textbf{Level type} & \\
   1  & Surface level \\
 100  & Isobaric level \\
 103  & Altitude above mean sea level \\
 105  & Height above ground \\
 107  & Sigma level \\
 109  & Hybrid level      \\
 110  & Layer between two hybrid levels   \\
 111  & Depth below land surface    \\
 112  & Layer between two depths below land surface   \\   
 113  & Isentropic (theta) level \\
 160  & Depth below sea level    \\
\end{tabular}

%\begin{itemize}
%\item   0 Latitude/longitude grid
%\item   4 Gaussian latitude/longitude grid
%\item  10 Rotated latitude/longitude grid
%\item  50 Spherical Harmonic Coefficients
%\item 192 Icosahedral-hexagonal GME grid
%\end{itemize}

%\begin{itemize}
%\item   1 Surface level
%\item 100 Isobaric level
%\item 103 Altitude above mean sea level
%\item 105 Height above ground
%\item 109 Hybrid level     
%\item 110 Layer between two hybrid levels  
%\item 111 Depth below land surface   
%\item 112 Layer between two depths below land surface     
%\item 113 Isentropic (theta) level
%\item 160 Depth below sea level   
%\end{itemize}


\section{NetCDF}

NetCDF \cite{NetCDF} (Network Common Data Form) is an interface for array-oriented data
access and a library that provides an implementation of the interface.
The netCDF library also defines a machine-independent format for 
representing scientific data. Together, the interface, library, and 
format support the creation, access, and sharing of scientific data.

{\CDI} only supports the classic data model of netCDF and arrays up to 4 dimensions.
These dimensions should only be used by the horizontal and vertical grid and the time.
The netCDF attributes should follow the
\href{http://ftp.unidata.ucar.edu/software/netcdf/docs/conventions.html}
     {GDT, COARDS or CF Conventions}.
NetCDF is an external library and not part of {\CDI}. To use netCDF with
{\CDI} the netCDF library must be installed before the configuration
of the {\CDI} library (see \htmlref{Build}{build}).

%\subsection{ncdap}


\section{SERVICE}

SERVICE is the binary exchange format of the atmospheric general
circulation model ECHAM \cite{ECHAM}.
It has a header section with 8 integer values followed by the data section.
The header and the data section have the standard Fortran blocking
for binary data records.
A SERVICE record can have an accuracy of 4 or 8 bytes and 
the byteorder can be little or big endian.
The following Fortran code example can be used to read a 
SERVICE record with an accuracy of 4 bytes:

\begin{lstlisting}[language=Fortran, backgroundcolor=\color{pyellow}, basicstyle=\small, columns=flexible]
   INTEGER*4 icode,ilevel,idate,itime,nlon,nlat,idispo1,idispo2
   REAL*4 field(mlon,mlat)
      ...
   READ(unit) icode,ilevel,idate,itime,nlon,nlat,idispo1,idispo2
   READ(unit) ((field(ilon,ilat), ilon=1,nlon), ilat=1,nlat)
\end{lstlisting}

The constants {\tt mlon} and {\tt mlat} must be greater or equal than {\tt nlon} and {\tt nlat}.
The meaning of the variables are:

\vspace*{3mm}
\hspace*{8mm}\begin{minipage}{10cm}
\begin{deflist}{{\tt idispo2 \ \ }}
\item[{\tt icode}]    The code number
\item[{\tt ilevel}]   The level
\item[{\tt idate}]    The date as YYYYMMDD
\item[{\tt itime}]    The time as HHMM
\item[{\tt nlon}]     The number of longitudes
\item[{\tt nlat}]     The number of latitides
\item[{\tt idispo1}]  For the users disposal (Not used in {\CDI})
\item[{\tt idispo2}]  For the users disposal (Not used in {\CDI})
\end{deflist}
\end{minipage}


\section{EXTRA}

EXTRA is the standard binary output format of the ocean model MPIOM
\cite{MPIOM}. It has a header section with 4 integer values followed by the
data section. The header and the data section have the standard Fortran
blocking for binary data records. An EXTRA record can have an accuracy of 4 or
8 bytes and the byteorder can be little or big endian.
The following Fortran code example can be used to read an
EXTRA record with an accuracy of 4 bytes:

\begin{lstlisting}[language=Fortran, backgroundcolor=\color{pyellow}, basicstyle=\small, columns=flexible]
   INTEGER*4 idate,icode,ilevel,nsize
   REAL*4 field(msize)
      ...
   READ(unit) idate,icode,ilevel,nsize
   READ(unit) (field(isize),isize=1,nsize)
\end{lstlisting}

The constant {\tt msize} must be greater or equal than {\tt nsize}.
The meaning of the variables are:

\vspace*{3mm}
\hspace*{8mm}\begin{minipage}{10cm}
\begin{deflist}{{\tt idispo2 \ \ }}
\item[{\tt idate}]    The date as YYYYMMDD
\item[{\tt icode}]    The code number
\item[{\tt ilevel}]   The level
\item[{\tt nsize}]    The size of the field
\end{deflist}
\end{minipage}


\section{IEG}

IEG is the standard binary output format of the regional model REMO \cite{REMO}.
It is simple an unpacked GRIB edition 1 format. The product and grid
description sections are coded with 4 byte integer values and the
data section can have 4 or 8 byte IEEE floating point values.
The header and the data section have the standard Fortran blocking
for binary data records. The IEG format has a fixed size of 100 for the
vertical coordinate table. That means it is not possible to store more
than 50 model levels with this format.
{\CDI} supports only data on Gaussian and LonLat grids for the IEG format.
