From 8030d77a8db822e54f8357e7ee679cd48e5e1d41 Mon Sep 17 00:00:00 2001
From: Uwe Schulzweida <uwe.schulzweida@mpimet.mpg.de>
Date: Fri, 12 May 2006 12:55:20 +0000
Subject: [PATCH] add dummy functions gridDestroy, zaxisDestroy, taxisDestroy

---
 .gitattributes          |   6 +
 ChangeLog               |   1 +
 Makefile.am             |   2 +-
 Makefile.in             |   2 +-
 configure               |   3 +-
 configure.ac            |   2 +-
 doc/tex/FUNCTIONS       |  19 ++-
 doc/tex/Modules         |  13 +-
 doc/tex/c_examples.tex  | 148 +++++++++++++++++
 doc/tex/c_grid.tex      |  44 +++--
 doc/tex/c_ref.tex       | 117 ++++++++------
 doc/tex/c_stream.tex    |  58 ++++---
 doc/tex/c_taxis.tex     |  30 +++-
 doc/tex/c_vlist.tex     |  18 +--
 doc/tex/c_vlist_var.tex |   6 +-
 doc/tex/c_zaxis.tex     |  30 +++-
 doc/tex/cdi_cman.tex    |   3 +
 doc/tex/f_grid.tex      |  44 +++--
 doc/tex/f_ref.tex       | 117 ++++++++------
 doc/tex/f_stream.tex    |  58 ++++---
 doc/tex/f_taxis.tex     |  30 +++-
 doc/tex/f_vlist.tex     |  18 +--
 doc/tex/f_vlist_var.tex |   6 +-
 doc/tex/f_zaxis.tex     |  30 +++-
 doc/tex/formats.tex     |  26 +--
 doc/tex/makedoc         |  11 +-
 doc/tex/usage.tex       |  32 ++--
 examples/Makefile.am    |  16 ++
 examples/Makefile.in    | 349 ++++++++++++++++++++++++++++++++++++++++
 examples/cdi_copy.c     |  86 ++++++++++
 examples/cdi_read.c     |  86 ++++++++++
 examples/cdi_write.c    |  86 ++++++++++
 prog/Makefile.am        |   4 +-
 prog/Makefile.in        |   8 +-
 src/cdi.h               |  22 ++-
 src/grid.c              |  29 +++-
 src/stream.c            |  44 +++--
 src/taxis.c             |  21 ++-
 src/vlist.c             |   2 +-
 src/zaxis.c             |  21 ++-
 40 files changed, 1362 insertions(+), 286 deletions(-)
 create mode 100644 doc/tex/c_examples.tex
 create mode 100644 examples/Makefile.am
 create mode 100644 examples/Makefile.in
 create mode 100644 examples/cdi_copy.c
 create mode 100644 examples/cdi_read.c
 create mode 100644 examples/cdi_write.c

diff --git a/.gitattributes b/.gitattributes
index 2ba40eee2..c60516eb7 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -20,6 +20,7 @@ config/mkinstalldirs -text
 /configure.ac -text
 doc/tex/FUNCTIONS -text
 doc/tex/Modules -text
+doc/tex/c_examples.tex -text
 doc/tex/c_grid.tex -text
 doc/tex/c_link.tex -text
 doc/tex/c_quick_ref.tex -text
@@ -51,6 +52,11 @@ doc/tex/makeps_c -text
 doc/tex/makeps_f -text
 doc/tex/test.tex -text
 doc/tex/usage.tex -text
+examples/Makefile.am -text
+examples/Makefile.in -text
+examples/cdi_copy.c -text
+examples/cdi_read.c -text
+examples/cdi_write.c -text
 prog/Makefile.am -text
 prog/Makefile.in -text
 prog/cdi.c -text
diff --git a/ChangeLog b/ChangeLog
index 132a78b6e..a026c9f21 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 
 	* using GRIB library version 1.0.0
 	* rename *New functions to *Create
+        * add dummy functions gridDestroy, zaxisDestroy, taxisDestroy
 	* Version 1.0.0 released
 
 2006-05-04  Uwe Schulzweida  <schulzweida@dkrz.de>
diff --git a/Makefile.am b/Makefile.am
index a0a762041..d8be992fe 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 #
-SUBDIRS = src prog tests
+SUBDIRS = src prog examples tests
 #
 EXTRA_DIST=config/default
 #
diff --git a/Makefile.in b/Makefile.in
index 6b28c90f3..267b2fea0 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -82,7 +82,7 @@ am__quote = @am__quote@
 install_sh = @install_sh@
 
 #
-SUBDIRS = src prog tests
+SUBDIRS = src prog examples tests
 #
 EXTRA_DIST = config/default
 #
diff --git a/configure b/configure
index 2877afe84..245ab16fe 100755
--- a/configure
+++ b/configure
@@ -6030,7 +6030,7 @@ FC=$F77
 
 
 
-                                        ac_config_files="$ac_config_files Makefile src/Makefile prog/Makefile tests/Makefile"
+                                                  ac_config_files="$ac_config_files Makefile src/Makefile prog/Makefile tests/Makefile examples/Makefile"
 cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
@@ -6577,6 +6577,7 @@ do
   "src/Makefile" ) CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
   "prog/Makefile" ) CONFIG_FILES="$CONFIG_FILES prog/Makefile" ;;
   "tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
+  "examples/Makefile" ) CONFIG_FILES="$CONFIG_FILES examples/Makefile" ;;
   "depfiles" ) CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
   "src/config.h" ) CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;;
   *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
diff --git a/configure.ac b/configure.ac
index 5ec063189..13a42a2ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -292,4 +292,4 @@ AC_SUBST([FC],$F77)
 AC_SUBST([CFINT])
 AC_SUBST([AR])
 
-AC_OUTPUT(Makefile src/Makefile prog/Makefile tests/Makefile)
+AC_OUTPUT(Makefile src/Makefile prog/Makefile tests/Makefile examples/Makefile)
diff --git a/doc/tex/FUNCTIONS b/doc/tex/FUNCTIONS
index 5edaf267b..f2a9b68f8 100644
--- a/doc/tex/FUNCTIONS
+++ b/doc/tex/FUNCTIONS
@@ -13,8 +13,8 @@ Function catalog:
    streamInqFiletype    Get the filetype
    streamDefVlist       Define the variable list
    streamInqVlist       Get the variable list
-   streamDefTimestep    Define timestep
-   streamInqTimestep    Get timestep
+   streamDefTimestep    Define time step
+   streamInqTimestep    Get time step
    streamWriteVar       Write a variable
    streamReadVar        Read a variable
    streamWriteVarSlice  Write a horizontal slice of a variable
@@ -22,8 +22,8 @@ Function catalog:
 -------------------------------------------------------------
    vlist
 -------------------------------------------------------------
-   vlistNew             Create a variable list
-   vlistFree            Delete a variable list
+   vlistCreate          Create a variable list
+   vlistDestroy         Destroy a variable list
    vlistCopy            Copy a variable list
    vlistDuplicate       Duplicate a variable list
    vlistCat             Concatenate two variable lists
@@ -50,8 +50,9 @@ Function catalog:
 -------------------------------------------------------------
    grid
 -------------------------------------------------------------
-   gridNew              Create a new Grid
-   gridDuplicate        Duplicate a grid
+   gridCreate           Create a horizontal Grid
+   gridDestroy          Destroy a horizontal Grid
+   gridDuplicate        Duplicate a horizontal Grid
    gridInqType          Get the type of a Grid
    gridInqSize          Get the size of a Grid
    gridDefXsize         Define the number of values of a X-axis
@@ -81,7 +82,8 @@ Function catalog:
 -------------------------------------------------------------
    zaxis
 -------------------------------------------------------------
-   zaxisNew             Create a new Z-axis
+   zaxisCreate          Create a vertical Z-axis
+   zaxisDestroy         Destroy a vertical Z-axis
    zaxisInqType         Get the type of a Z-axis
    zaxisInqSize         Get the size of a Z-axis
    zaxisDefLevels       Define the levels of a Z-axis
@@ -96,7 +98,8 @@ Function catalog:
 -------------------------------------------------------------
    taxis
 -------------------------------------------------------------
-   taxisNew             Create a new T-axis
+   taxisCreate          Create a Time axis
+   taxisDestroy         Destroy a Time axis
    taxisDefRdate        Define the reference date
    taxisInqRdate        Get the reference date
    taxisDefRtime        Define the reference time
diff --git a/doc/tex/Modules b/doc/tex/Modules
index 899d1fe70..f78e9aac6 100644
--- a/doc/tex/Modules
+++ b/doc/tex/Modules
@@ -10,8 +10,8 @@ streamWriteVar      stream
 streamReadVar       stream
 streamWriteVarSlice stream
 streamReadVarSlice  stream
-vlistNew            vlist
-vlistFree           vlist
+vlistCreate         vlist
+vlistDestroy        vlist
 vlistCopy           vlist
 vlistDuplicate      vlist
 vlistCat            vlist
@@ -37,7 +37,8 @@ vlistDefVarDatatype vlist_var
 vlistInqVarDatatype vlist_var
 vlistDefVarMissval  vlist_var
 vlistInqVarMissval  vlist_var
-gridNew             grid
+gridCreate          grid
+gridDestroy         grid
 gridDuplicate       grid
 gridInqType         grid
 gridInqSize         grid
@@ -65,7 +66,8 @@ gridDefYlongname    grid
 gridInqYlongname    grid
 gridDefYunits       grid
 gridInqYunits       grid
-zaxisNew            zaxis
+zaxisCreate         zaxis
+zaxisDestroy        zaxis
 zaxisInqType        zaxis
 zaxisInqSize        zaxis
 zaxisDefLevels      zaxis
@@ -77,7 +79,8 @@ zaxisDefLongname    zaxis
 zaxisInqLongname    zaxis
 zaxisDefUnits       zaxis
 zaxisInqUnits       zaxis
-taxisNew            taxis
+taxisCreate         taxis
+taxisDestroy        taxis
 taxisDefRdate       taxis
 taxisInqRdate       taxis
 taxisDefRtime       taxis
diff --git a/doc/tex/c_examples.tex b/doc/tex/c_examples.tex
new file mode 100644
index 000000000..c0da7de16
--- /dev/null
+++ b/doc/tex/c_examples.tex
@@ -0,0 +1,148 @@
+\appendix
+
+\chapter{\label{appendixa}Examples}
+
+\section{Write variables to a dataset}
+
+\begin{lstlisting}[frame=single, backgroundcolor=\color{zebg}, basicstyle=\footnotesize]
+#include "cdi.h"
+
+#define NLON  12 /* Number of longitudes */
+#define NLAT   6 /* Number of latitudes  */
+#define NLEV   5 /* Number of levels     */
+#define NTIME  3 /* Number of time steps */
+
+int main(void)
+{
+  int gridID, zaxisID1, zaxisID2, taxisID;
+  int vlistID, varID1, varID2, streamID;
+  int tsID;
+  int i, nmiss = 0;
+  double lons[NLON] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330};
+  double lats[NLAT] = {-75, -45, -15, 15, 45, 75};
+  double levs[NLEV] = {101300, 92500, 85000, 50000, 20000};
+  double var1[NLON*NLAT];
+  double var2[NLON*NLAT*NLEV];
+
+  /* Create a LONLAT grid */
+  gridID  = gridCreate(GRID_LONLAT, NLON*NLAT);
+  gridDefXsize(gridID, NLON);
+  gridDefYsize(gridID, NLAT);
+  gridDefXvals(gridID, lons);
+  gridDefYvals(gridID, lats);
+
+  /* Create a surface Z-axis */
+  zaxisID1 = zaxisCreate(ZAXIS_SURFACE, 1);
+
+  /* Create a pressure level Z-axis */
+  zaxisID2 = zaxisCreate(ZAXIS_PRESSURE, NLEV);
+  zaxisDefLevels(zaxisID2, levs);
+ 
+  /* Create a variable list */
+  vlistID = vlistCreate();
+
+  /* Define the variables */
+  varID1  = vlistDefVar(vlistID, gridID, zaxisID1, TIME_VARIABLE);
+  varID2  = vlistDefVar(vlistID, gridID, zaxisID2, TIME_VARIABLE);
+
+  /* Define variable name */
+  vlistDefVarName(vlistID, varID1, "varname1");
+  vlistDefVarName(vlistID, varID2, "varname2");
+
+  /* Create a Time axis */
+  taxisID = taxisCreate(TAXIS_ABSOLUTE);
+
+  /* Assign the Time axis to the variable list */
+  vlistDefTaxis(vlistID, taxisID);
+
+  /* Create a dataset */
+  streamID  = streamOpenWrite("example.nc", FILETYPE_NC);
+
+  /* Assign the variable list to the dataset */
+  streamDefVlist(streamID, vlistID);
+
+  /* Loop over the number of time steps */
+  for ( tsID = 0; tsID < NTIME; tsID++ )
+    {
+      /* Set the verification date to 1985-01-01 + tsID */
+      taxisDefVdate(taxisID, 19850101+tsID);
+      /* Set the verification time to 12:00 */
+      taxisDefVtime(taxisID, 1200);
+      /* Define the time step */
+      streamDefTimestep(streamID, tsID);
+
+      /* Write var1 */
+      for ( i = 0; i < NLON*NLAT; i++ ) var1[i] = 1;
+      streamWriteVar(streamID, varID1, var1, nmiss);
+      /* Write var2 */
+      for ( i = 0; i < NLON*NLAT*NLEV; i++ ) var2[i] = 2;
+      streamWriteVar(streamID, varID2, var2, nmiss);
+    }
+
+  /* Close the output stream */
+  streamClose(streamID);
+
+  /* Destroy the created objects */
+  vlistDestroy(vlistID);
+  taxisDestroy(taxisID);
+  zaxisDestroy(zaxisID1);
+  zaxisDestroy(zaxisID2);
+  gridDestroy(gridID);
+
+  return 0;
+}
+\end{lstlisting}
+
+\subsection{Result}
+\begin{lstlisting}[frame=single, backgroundcolor=\color{zebg}, basicstyle=\footnotesize]
+netcdf example {
+dimensions:
+        lon = 12 ;
+        lat = 6 ;
+        lev = 5 ;
+        time = UNLIMITED ; // (3 currently)
+variables:
+        double lon(lon) ;
+                lon:long_name = "longitude" ;
+                lon:units = "degrees_east" ;
+                lon:standard_name = "longitude" ;
+        double lat(lat) ;
+                lat:long_name = "latitude" ;
+                lat:units = "degrees_north" ;
+                lat:standard_name = "latitude" ;
+        double lev(lev) ;
+                lev:long_name = "pressure" ;
+                lev:units = "Pa" ;
+        double time(time) ;
+                time:units = "day as %Y%m%d.%f" ;
+        float varname1(time, lat, lon) ;
+        float varname2(time, lev, lat, lon) ;
+
+// global attributes:
+                :CDI = "Climate Data Interface version 1.0.0" ;
+                :Conventions = "CF-1.0" ;
+data:
+
+ lon = 0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330 ;
+
+ lat = -75, -45, -15, 15, 45, 75 ;
+
+ lev = 101300, 92500, 85000, 50000, 20000 ;
+
+ time = 19850101.5, 19850102.5, 19850103.5 ;
+}
+\end{lstlisting}
+
+
+\section{Read a dataset}
+
+\begin{lstlisting}[frame=single, backgroundcolor=\color{zebg}, basicstyle=\footnotesize]
+\end{lstlisting}
+
+
+\section{Write variables to a dataset}
+
+\begin{lstlisting}[frame=single, backgroundcolor=\color{zebg}, basicstyle=\footnotesize]
+\end{lstlisting}
+
+\section{Copy a dataset}
diff --git a/doc/tex/c_grid.tex b/doc/tex/c_grid.tex
index 7a8ee75d7..b84a3aa71 100644
--- a/doc/tex/c_grid.tex
+++ b/doc/tex/c_grid.tex
@@ -1,15 +1,15 @@
 
 
-\section{Create a new Grid: {\tt gridNew}}
-\index{gridNew}
-\label{gridNew}
+\section{Create a horizontal Grid: {\tt gridCreate}}
+\index{gridCreate}
+\label{gridCreate}
 
-The function {\tt gridNew} creates a new Grid.
+The function {\tt gridCreate} creates a horizontal Grid.
 
 \subsection*{Usage}
 
 \begin{verbatim}
-    int gridNew(int gridtype, int size);
+    int gridCreate(int gridtype, int size);
 \end{verbatim}
 
 \hspace*{4mm}\begin{minipage}[]{15cm}
@@ -26,12 +26,14 @@ Number of gridpoints.
 
 \subsection*{Result}
 
-{\tt gridNew} returns an identifier to the new Grid.
+{\tt gridCreate} returns an identifier to the Grid.
 
 
 \subsection*{Example}
 
-Here is an example using {\tt gridNew} to create a new {\tt LONLAT} Grid:\begin{verbatim}
+Here is an example using {\tt gridCreate} to create a {\tt LONLAT} Grid:
+
+\begin{lstlisting}[backgroundcolor=\color{zebg}, basicstyle=\footnotesize]
     #include <cdi.h>
        ...
     int gridID;
@@ -40,20 +42,38 @@ Here is an example using {\tt gridNew} to create a new {\tt LONLAT} Grid:\begin{
     double lons[nlon] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330};
     double lats[nlat] = {-75, -45, -15, 15, 45, 75};
        ...
-    gridID = gridNew(GRID_LONLAT, nlon*nlat);
+    gridID = gridCreate(GRID_LONLAT, nlon*nlat);
     gridDefXsize(gridID, nlon);
     gridDefYsize(gridID, nlat);
     gridDefXvals(gridID, lons);
     gridDefYvals(gridID, lats);
        ...
+\end{lstlisting}
+
+
+\section{Destroy a horizontal Grid: {\tt gridDestroy}}
+\index{gridDestroy}
+\label{gridDestroy}
+\subsection*{Usage}
+
+\begin{verbatim}
+    void gridDestroy(int gridID);
 \end{verbatim}
 
+\hspace*{4mm}\begin{minipage}[]{15cm}
+\begin{deflist}{\tt gridID\ }
+\item[{\tt gridID}]
+Identifier, from a previous call to {\tt gridCreate}
+
+\end{deflist}
+\end{minipage}
+
 
-\section{Duplicate a grid: {\tt gridDuplicate}}
+\section{Duplicate a horizontal Grid: {\tt gridDuplicate}}
 \index{gridDuplicate}
 \label{gridDuplicate}
 
-The function {\tt gridDuplicate} duplicates a grid.
+The function {\tt gridDuplicate} duplicates a horizontal Grid.
 
 \subsection*{Usage}
 
@@ -64,7 +84,7 @@ The function {\tt gridDuplicate} duplicates a grid.
 \hspace*{4mm}\begin{minipage}[]{15cm}
 \begin{deflist}{\tt gridID\ }
 \item[{\tt gridID}]
-Identifier, from a previous call to {\tt gridNew},
+Identifier, from a previous call to {\tt gridCreate},
                    {\tt gridDuplicate} or {\tt vlistInqVarGrid}.
 
 \end{deflist}
@@ -72,7 +92,7 @@ Identifier, from a previous call to {\tt gridNew},
 
 \subsection*{Result}
 
-{\tt gridDuplicate} returns an identifier to the duplicated grid.
+{\tt gridDuplicate} returns an identifier to the duplicated Grid.
 
 
 
diff --git a/doc/tex/c_ref.tex b/doc/tex/c_ref.tex
index b543306c9..f5b300d1b 100644
--- a/doc/tex/c_ref.tex
+++ b/doc/tex/c_ref.tex
@@ -1,5 +1,14 @@
 
 
+\section*{\tt \htmlref{gridCreate}{gridCreate}}
+
+\begin{verbatim}
+    int gridCreate(int gridtype, int size);
+\end{verbatim}
+
+Create a horizontal Grid
+
+
 \section*{\tt \htmlref{gridDefXbounds}{gridDefXbounds}}
 
 \begin{verbatim}
@@ -108,13 +117,22 @@ Define the units of a Y-axis
 Define the values of a Y-axis
 
 
+\section*{\tt \htmlref{gridDestroy}{gridDestroy}}
+
+\begin{verbatim}
+    void gridDestroy(int gridID);
+\end{verbatim}
+
+Destroy a horizontal Grid
+
+
 \section*{\tt \htmlref{gridDuplicate}{gridDuplicate}}
 
 \begin{verbatim}
     int gridDuplicate(int gridID);
 \end{verbatim}
 
-Duplicate a grid
+Duplicate a horizontal Grid
 
 
 \section*{\tt \htmlref{gridInqSize}{gridInqSize}}
@@ -243,15 +261,6 @@ Get the units of a Y-axis
 Get all values of a Y-axis
 
 
-\section*{\tt \htmlref{gridNew}{gridNew}}
-
-\begin{verbatim}
-    int gridNew(int gridtype, int size);
-\end{verbatim}
-
-Create a new Grid
-
-
 \section*{\tt \htmlref{streamClose}{streamClose}}
 
 \begin{verbatim}
@@ -267,7 +276,7 @@ Close an open dataset
     int streamDefTimestep(int streamID, int tsID);
 \end{verbatim}
 
-Define timestep
+Define time step
 
 
 \section*{\tt \htmlref{streamDefVlist}{streamDefVlist}}
@@ -294,7 +303,7 @@ Get the filetype
     int streamInqTimestep(int streamID, int tsID);
 \end{verbatim}
 
-Get timestep
+Get time step
 
 
 \section*{\tt \htmlref{streamInqVlist}{streamInqVlist}}
@@ -362,6 +371,15 @@ Write a variable
 Write a horizontal slice of a variable
 
 
+\section*{\tt \htmlref{taxisCreate}{taxisCreate}}
+
+\begin{verbatim}
+    int taxisCreate(int taxistype);
+\end{verbatim}
+
+Create a Time axis
+
+
 \section*{\tt \htmlref{taxisDefCalendar}{taxisDefCalendar}}
 
 \begin{verbatim}
@@ -407,6 +425,15 @@ Define the verification date
 Define the verification time
 
 
+\section*{\tt \htmlref{taxisDestroy}{taxisDestroy}}
+
+\begin{verbatim}
+    void taxisDestroy(int taxisID);
+\end{verbatim}
+
+Destroy a Time axis
+
+
 \section*{\tt \htmlref{taxisInqCalendar}{taxisInqCalendar}}
 
 \begin{verbatim}
@@ -452,15 +479,6 @@ Get the verification date
 Get the verification time
 
 
-\section*{\tt \htmlref{taxisNew}{taxisNew}}
-
-\begin{verbatim}
-    int taxisNew(int taxistype);
-\end{verbatim}
-
-Create a new T-axis
-
-
 \section*{\tt \htmlref{vlistCat}{vlistCat}}
 
 \begin{verbatim}
@@ -488,6 +506,15 @@ Copy a variable list
 Copy some entries of a variable list
 
 
+\section*{\tt \htmlref{vlistCreate}{vlistCreate}}
+
+\begin{verbatim}
+    int vlistCreate(void);
+\end{verbatim}
+
+Create a variable list
+
+
 \section*{\tt \htmlref{vlistDefVar}{vlistDefVar}}
 
 \begin{verbatim}
@@ -551,22 +578,22 @@ Define the name of a Variable
 Define the units of a Variable
 
 
-\section*{\tt \htmlref{vlistDuplicate}{vlistDuplicate}}
+\section*{\tt \htmlref{vlistDestroy}{vlistDestroy}}
 
 \begin{verbatim}
-    int vlistDuplicate(int vlistID);
+    void vlistDestroy(int vlistID);
 \end{verbatim}
 
-Duplicate a variable list
+Destroy a variable list
 
 
-\section*{\tt \htmlref{vlistFree}{vlistFree}}
+\section*{\tt \htmlref{vlistDuplicate}{vlistDuplicate}}
 
 \begin{verbatim}
-    void vlistFree(int vlistID);
+    int vlistDuplicate(int vlistID);
 \end{verbatim}
 
-Delete a variable list
+Duplicate a variable list
 
 
 \section*{\tt \htmlref{vlistInqVarCode}{vlistInqVarCode}}
@@ -623,15 +650,6 @@ Get the name of a Variable
 Get the units of a Variable
 
 
-\section*{\tt \htmlref{vlistNew}{vlistNew}}
-
-\begin{verbatim}
-    int vlistNew(void);
-\end{verbatim}
-
-Create a variable list
-
-
 \section*{\tt \htmlref{vlistNgrids}{vlistNgrids}}
 
 \begin{verbatim}
@@ -659,6 +677,15 @@ Number of variables in a variable list
 Number of zaxis in a variable list
 
 
+\section*{\tt \htmlref{zaxisCreate}{zaxisCreate}}
+
+\begin{verbatim}
+    int zaxisCreate(int zaxistype, int size);
+\end{verbatim}
+
+Create a vertical Z-axis
+
+
 \section*{\tt \htmlref{zaxisDefLevels}{zaxisDefLevels}}
 
 \begin{verbatim}
@@ -695,6 +722,15 @@ Define the name of a Z-axis
 Define the units of a Z-axis
 
 
+\section*{\tt \htmlref{zaxisDestroy}{zaxisDestroy}}
+
+\begin{verbatim}
+    void zaxisDestroy(int zaxisID);
+\end{verbatim}
+
+Destroy a vertical Z-axis
+
+
 \section*{\tt \htmlref{zaxisInqLevel}{zaxisInqLevel}}
 
 \begin{verbatim}
@@ -756,12 +792,3 @@ Get the type of a Z-axis
 \end{verbatim}
 
 Get the units of a Z-axis
-
-
-\section*{\tt \htmlref{zaxisNew}{zaxisNew}}
-
-\begin{verbatim}
-    int zaxisNew(int zaxistype, int size);
-\end{verbatim}
-
-Create a new Z-axis
diff --git a/doc/tex/c_stream.tex b/doc/tex/c_stream.tex
index 77f49f26c..a8266109b 100644
--- a/doc/tex/c_stream.tex
+++ b/doc/tex/c_stream.tex
@@ -18,7 +18,7 @@ The name of the new dataset
 \item[{\tt filetype}]
 The type of the file format, one of the set of predefined CDI file format types.
                      The valid CDI file format types are {\tt FILETYPE\_GRB}, {\tt FILETYPE\_NC},
-                     {\tt FILETYPE\_NC2}, {\tt FILETYPE\_SRV}, and {\tt FILETYPE\_EXT}.
+                     {\tt FILETYPE\_NC2}, {\tt FILETYPE\_SRV}, {\tt FILETYPE\_EXT} and {\tt FILETYPE\_IEG}.
 
 \end{deflist}
 \end{minipage}
@@ -48,7 +48,10 @@ Library not available
 
 \subsection*{Example}
 
-Here is an example using {\tt streamOpenWrite} to create a new netCDF file named {\tt foo.nc} for writing:\begin{verbatim}
+Here is an example using {\tt streamOpenWrite} to create a new netCDF file 
+named {\tt foo.nc} for writing:
+
+\begin{lstlisting}[backgroundcolor=\color{zebg}, basicstyle=\footnotesize]
     #include <cdi.h>
        ...
     int streamID;
@@ -56,7 +59,7 @@ Here is an example using {\tt streamOpenWrite} to create a new netCDF file named
     streamID = streamOpenWrite("foo.nc", FILETYPE_NC);
     if ( streamID < 0 ) handle_error(streamID);
        ...
-\end{verbatim}
+\end{lstlisting}
 
 
 \section{Open a dataset for reading: {\tt streamOpenRead}}
@@ -104,7 +107,10 @@ Library not available
 
 \subsection*{Example}
 
-Here is an example using {\tt streamOpenRead} to open an existing netCDFfile named {\tt foo.nc} for reading:\begin{verbatim}
+Here is an example using {\tt streamOpenRead} to open an existing netCDF
+file named {\tt foo.nc} for reading:
+
+\begin{lstlisting}[backgroundcolor=\color{zebg}, basicstyle=\footnotesize]
     #include <cdi.h>
        ...
     int streamID;
@@ -112,7 +118,7 @@ Here is an example using {\tt streamOpenRead} to open an existing netCDFfile nam
     streamID = streamOpenRead("foo.nc");
     if ( streamID < 0 ) handle_error(streamID);
        ...
-\end{verbatim}
+\end{lstlisting}
 
 
 \section{Close an open dataset: {\tt streamClose}}
@@ -162,7 +168,7 @@ Stream identifier
 {\tt streamInqFiletype} returns the type of the file format,
 one of the set of predefined CDI file format types.
 The valid CDI file format types are {\tt FILETYPE\_GRB}, {\tt FILETYPE\_NC},
-{\tt FILETYPE\_NC2}, {\tt FILETYPE\_SRV}, and {\tt FILETYPE\_EXT}.
+{\tt FILETYPE\_NC2}, {\tt FILETYPE\_SRV}, {\tt FILETYPE\_EXT} and {\tt FILETYPE\_IEG}.
 
 
 
@@ -215,11 +221,11 @@ Stream identifier
 
 
 
-\section{Define timestep: {\tt streamDefTimestep}}
+\section{Define time step: {\tt streamDefTimestep}}
 \index{streamDefTimestep}
 \label{streamDefTimestep}
 
-The function {\tt streamDefTimestep} defines the timestep of a stream.
+The function {\tt streamDefTimestep} defines the time step of a stream.
 
 \subsection*{Usage}
 
@@ -239,15 +245,15 @@ Timestep identifier
 
 \subsection*{Result}
 
-{\tt streamDefTimestep} returns the number of records of the timestep.
+{\tt streamDefTimestep} returns the number of records of the time step.
 
 
 
-\section{Get timestep: {\tt streamInqTimestep}}
+\section{Get time step: {\tt streamInqTimestep}}
 \index{streamInqTimestep}
 \label{streamInqTimestep}
 
-The function {\tt streamInqTimestep} returns the timestep of a stream.
+The function {\tt streamInqTimestep} returns the time step of a stream.
 
 \subsection*{Usage}
 
@@ -267,13 +273,16 @@ Timestep identifier
 
 \subsection*{Result}
 
-{\tt streamInqTimestep} returns the number of records of the timestep.
+{\tt streamInqTimestep} returns the number of records of the time step.
 
 
 
 \section{Write a variable: {\tt streamWriteVar}}
 \index{streamWriteVar}
 \label{streamWriteVar}
+
+The function streamWriteVar writes the values of one time step of a variable 
+to an open dataset.
 \subsection*{Usage}
 
 \begin{verbatim}
@@ -283,11 +292,11 @@ Timestep identifier
 \hspace*{4mm}\begin{minipage}[]{15cm}
 \begin{deflist}{\tt streamID\ }
 \item[{\tt streamID}]
-Stream identifier
+Stream identifier, from a previous call to streamOpenWrite
 \item[{\tt varID}]
 Variable identifier
 \item[{\tt data}]
-Data
+Pointer to a block of data values to be written
 \item[{\tt nmiss}]
 Number of missing values
 
@@ -298,6 +307,9 @@ Number of missing values
 \section{Read a variable: {\tt streamReadVar}}
 \index{streamReadVar}
 \label{streamReadVar}
+
+The function streamReadVar reads all the values of one time step of a variable
+from an open dataset.
 \subsection*{Usage}
 
 \begin{verbatim}
@@ -307,11 +319,11 @@ Number of missing values
 \hspace*{4mm}\begin{minipage}[]{15cm}
 \begin{deflist}{\tt streamID\ }
 \item[{\tt streamID}]
-Stream identifier
+Stream identifier, from a previous call to streamOpenRead
 \item[{\tt varID}]
 Variable identifier
 \item[{\tt data}]
-Data
+Pointer to the location into which the data value is read
 \item[{\tt nmiss}]
 Number of missing values
 
@@ -322,6 +334,9 @@ Number of missing values
 \section{Write a horizontal slice of a variable: {\tt streamWriteVarSlice}}
 \index{streamWriteVarSlice}
 \label{streamWriteVarSlice}
+
+The function streamWriteVarSlice writes the values of a horizontal slice of a 
+variable to an open dataset.
 \subsection*{Usage}
 
 \begin{verbatim}
@@ -332,13 +347,13 @@ Number of missing values
 \hspace*{4mm}\begin{minipage}[]{15cm}
 \begin{deflist}{\tt streamID\ }
 \item[{\tt streamID}]
-Stream identifier
+Stream identifier, from a previous call to streamOpenWrite
 \item[{\tt varID}]
 Variable identifier
 \item[{\tt levelID}]
 Level identifier
 \item[{\tt data}]
-Data
+Pointer to a block of data values to be written
 \item[{\tt nmiss}]
 Number of missing values
 
@@ -349,6 +364,9 @@ Number of missing values
 \section{Read a horizontal slice of a variable: {\tt streamReadVarSlice}}
 \index{streamReadVarSlice}
 \label{streamReadVarSlice}
+
+The function streamReadVar reads all the values of a horizontal slice of a variable
+from an open dataset.
 \subsection*{Usage}
 
 \begin{verbatim}
@@ -359,13 +377,13 @@ Number of missing values
 \hspace*{4mm}\begin{minipage}[]{15cm}
 \begin{deflist}{\tt streamID\ }
 \item[{\tt streamID}]
-Stream identifier
+Stream identifier, from a previous call to streamOpenRead
 \item[{\tt varID}]
 Variable identifier
 \item[{\tt levelID}]
 Level identifier
 \item[{\tt data}]
-Data
+Pointer to the location into which the data value is read
 \item[{\tt nmiss}]
 Number of missing values
 
diff --git a/doc/tex/c_taxis.tex b/doc/tex/c_taxis.tex
index 872691eae..2822f806a 100644
--- a/doc/tex/c_taxis.tex
+++ b/doc/tex/c_taxis.tex
@@ -1,15 +1,15 @@
 
 
-\section{Create a new T-axis: {\tt taxisNew}}
-\index{taxisNew}
-\label{taxisNew}
+\section{Create a Time axis: {\tt taxisCreate}}
+\index{taxisCreate}
+\label{taxisCreate}
 
-The function {\tt taxisNew} creates a new Time axis.
+The function {\tt taxisCreate} creates a Time axis.
 
 \subsection*{Usage}
 
 \begin{verbatim}
-    int taxisNew(int taxistype);
+    int taxisCreate(int taxistype);
 \end{verbatim}
 
 \hspace*{4mm}\begin{minipage}[]{15cm}
@@ -23,10 +23,28 @@ The type of the time axis, one of the set of predefined CDI time types.
 
 \subsection*{Result}
 
-{\tt taxisNew} returns an identifier to the new T-axis.
+{\tt taxisCreate} returns an identifier to the Time axis.
 
 
 
+\section{Destroy a Time axis: {\tt taxisDestroy}}
+\index{taxisDestroy}
+\label{taxisDestroy}
+\subsection*{Usage}
+
+\begin{verbatim}
+    void taxisDestroy(int taxisID);
+\end{verbatim}
+
+\hspace*{4mm}\begin{minipage}[]{15cm}
+\begin{deflist}{\tt taxisID\ }
+\item[{\tt taxisID}]
+Identifier, from a previous call to {\tt taxisCreate}
+
+\end{deflist}
+\end{minipage}
+
+
 \section{Define the reference date: {\tt taxisDefRdate}}
 \index{taxisDefRdate}
 \label{taxisDefRdate}
diff --git a/doc/tex/c_vlist.tex b/doc/tex/c_vlist.tex
index 474338392..4b6492cc0 100644
--- a/doc/tex/c_vlist.tex
+++ b/doc/tex/c_vlist.tex
@@ -1,28 +1,28 @@
 
 
-\section{Create a variable list: {\tt vlistNew}}
-\index{vlistNew}
-\label{vlistNew}
+\section{Create a variable list: {\tt vlistCreate}}
+\index{vlistCreate}
+\label{vlistCreate}
 \subsection*{Usage}
 
 \begin{verbatim}
-    int vlistNew(void);
+    int vlistCreate(void);
 \end{verbatim}
 
 
-\section{Delete a variable list: {\tt vlistFree}}
-\index{vlistFree}
-\label{vlistFree}
+\section{Destroy a variable list: {\tt vlistDestroy}}
+\index{vlistDestroy}
+\label{vlistDestroy}
 \subsection*{Usage}
 
 \begin{verbatim}
-    void vlistFree(int vlistID);
+    void vlistDestroy(int vlistID);
 \end{verbatim}
 
 \hspace*{4mm}\begin{minipage}[]{15cm}
 \begin{deflist}{\tt vlistID\ }
 \item[{\tt vlistID}]
-Identifier, from a previous call to {\tt vlistNew}
+Identifier, from a previous call to {\tt vlistCreate}
 
 \end{deflist}
 \end{minipage}
diff --git a/doc/tex/c_vlist_var.tex b/doc/tex/c_vlist_var.tex
index b06571975..289b5f5eb 100644
--- a/doc/tex/c_vlist_var.tex
+++ b/doc/tex/c_vlist_var.tex
@@ -15,11 +15,11 @@ The function {\tt vlistDefVar} adds a new variable to vlistID.
 \hspace*{4mm}\begin{minipage}[]{15cm}
 \begin{deflist}{\tt vlistID\ }
 \item[{\tt vlistID}]
-Variable list ID, from a previous call to vlistNew or vlistCopy
+Variable list ID, from a previous call to vlistCreate or vlistCopy
 \item[{\tt gridID}]
-Grid ID, from a previous call to gridNew
+Grid ID, from a previous call to gridCreate
 \item[{\tt zaxisID}]
-Z-axis ID, from a previous call to zaxisNew
+Z-axis ID, from a previous call to zaxisCreate
 \item[{\tt timeID}]
 One of the set of predefined CDI time identifiers.
                      The valid CDI time identifiers are TIME\_CONSTANT and TIME\_VARIABLE.
diff --git a/doc/tex/c_zaxis.tex b/doc/tex/c_zaxis.tex
index 2269cdea0..b0091e310 100644
--- a/doc/tex/c_zaxis.tex
+++ b/doc/tex/c_zaxis.tex
@@ -1,15 +1,15 @@
 
 
-\section{Create a new Z-axis: {\tt zaxisNew}}
-\index{zaxisNew}
-\label{zaxisNew}
+\section{Create a vertical Z-axis: {\tt zaxisCreate}}
+\index{zaxisCreate}
+\label{zaxisCreate}
 
-The function {\tt zaxisNew} creates a new Z-axis.
+The function {\tt zaxisCreate} creates a vertical Z-axis.
 
 \subsection*{Usage}
 
 \begin{verbatim}
-    int zaxisNew(int zaxistype, int size);
+    int zaxisCreate(int zaxistype, int size);
 \end{verbatim}
 
 \hspace*{4mm}\begin{minipage}[]{15cm}
@@ -27,10 +27,28 @@ Number of levels
 
 \subsection*{Result}
 
-{\tt zaxisNew} returns an identifier to the new Z-axis.
+{\tt zaxisCreate} returns an identifier to the vertical Z-axis.
 
 
 
+\section{Destroy a vertical Z-axis: {\tt zaxisDestroy}}
+\index{zaxisDestroy}
+\label{zaxisDestroy}
+\subsection*{Usage}
+
+\begin{verbatim}
+    void zaxisDestroy(int zaxisID);
+\end{verbatim}
+
+\hspace*{4mm}\begin{minipage}[]{15cm}
+\begin{deflist}{\tt zaxisID\ }
+\item[{\tt zaxisID}]
+Identifier, from a previous call to {\tt zaxisCreate}
+
+\end{deflist}
+\end{minipage}
+
+
 \section{Get the type of a Z-axis: {\tt zaxisInqType}}
 \index{zaxisInqType}
 \label{zaxisInqType}
diff --git a/doc/tex/cdi_cman.tex b/doc/tex/cdi_cman.tex
index 84db85b2f..a7d2cc38b 100644
--- a/doc/tex/cdi_cman.tex
+++ b/doc/tex/cdi_cman.tex
@@ -193,6 +193,9 @@
 \input{bib}
 
 
+\input{c_examples}
+
+
 \chapter*{Quick Reference\markboth{Quick Reference}{}}
 \addcontentsline{toc}{chapter}{Quick Reference}
 
diff --git a/doc/tex/f_grid.tex b/doc/tex/f_grid.tex
index 2478f2335..1c0be1f95 100644
--- a/doc/tex/f_grid.tex
+++ b/doc/tex/f_grid.tex
@@ -1,15 +1,15 @@
 
 
-\section{Create a new Grid: {\tt gridNew}}
-\index{gridNew}
-\label{gridNew}
+\section{Create a horizontal Grid: {\tt gridCreate}}
+\index{gridCreate}
+\label{gridCreate}
 
-The function {\tt gridNew} creates a new Grid.
+The function {\tt gridCreate} creates a horizontal Grid.
 
 \subsection*{Usage}
 
 \begin{verbatim}
-    INTEGER FUNCTION gridNew(INTEGER gridtype, INTEGER size)
+    INTEGER FUNCTION gridCreate(INTEGER gridtype, INTEGER size)
 \end{verbatim}
 
 \hspace*{4mm}\begin{minipage}[]{15cm}
@@ -26,12 +26,14 @@ Number of gridpoints.
 
 \subsection*{Result}
 
-{\tt gridNew} returns an identifier to the new Grid.
+{\tt gridCreate} returns an identifier to the Grid.
 
 
 \subsection*{Example}
 
-Here is an example using {\tt gridNew} to create a new {\tt LONLAT} Grid:\begin{verbatim}
+Here is an example using {\tt gridCreate} to create a {\tt LONLAT} Grid:
+
+\begin{lstlisting}[backgroundcolor=\color{zebg}, basicstyle=\footnotesize]
     INCLUDE 'cdi.h'
        ...
     INTEGER gridID
@@ -40,20 +42,38 @@ Here is an example using {\tt gridNew} to create a new {\tt LONLAT} Grid:\begin{
     REAL*8 lons(nlon) = (/0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330/)
     REAL*8 lats(nlat) = (/-75, -45, -15, 15, 45, 75/)
        ...
-    gridID = gridNew(GRID_LONLAT, nlon*nlat)
+    gridID = gridCreate(GRID_LONLAT, nlon*nlat)
     CALL gridDefXsize(gridID, nlon)
     CALL gridDefYsize(gridID, nlat)
     CALL gridDefXvals(gridID, lons)
     CALL gridDefYvals(gridID, lats)
        ...
+\end{lstlisting}
+
+
+\section{Destroy a horizontal Grid: {\tt gridDestroy}}
+\index{gridDestroy}
+\label{gridDestroy}
+\subsection*{Usage}
+
+\begin{verbatim}
+    SUBROUTINE gridDestroy(INTEGER gridID)
 \end{verbatim}
 
+\hspace*{4mm}\begin{minipage}[]{15cm}
+\begin{deflist}{\tt gridID\ }
+\item[{\tt gridID}]
+Identifier, from a previous call to {\tt gridCreate}
+
+\end{deflist}
+\end{minipage}
+
 
-\section{Duplicate a grid: {\tt gridDuplicate}}
+\section{Duplicate a horizontal Grid: {\tt gridDuplicate}}
 \index{gridDuplicate}
 \label{gridDuplicate}
 
-The function {\tt gridDuplicate} duplicates a grid.
+The function {\tt gridDuplicate} duplicates a horizontal Grid.
 
 \subsection*{Usage}
 
@@ -64,7 +84,7 @@ The function {\tt gridDuplicate} duplicates a grid.
 \hspace*{4mm}\begin{minipage}[]{15cm}
 \begin{deflist}{\tt gridID\ }
 \item[{\tt gridID}]
-Identifier, from a previous call to {\tt gridNew},
+Identifier, from a previous call to {\tt gridCreate},
                    {\tt gridDuplicate} or {\tt vlistInqVarGrid}.
 
 \end{deflist}
@@ -72,7 +92,7 @@ Identifier, from a previous call to {\tt gridNew},
 
 \subsection*{Result}
 
-{\tt gridDuplicate} returns an identifier to the duplicated grid.
+{\tt gridDuplicate} returns an identifier to the duplicated Grid.
 
 
 
diff --git a/doc/tex/f_ref.tex b/doc/tex/f_ref.tex
index 1a997eacd..01af3d217 100644
--- a/doc/tex/f_ref.tex
+++ b/doc/tex/f_ref.tex
@@ -1,5 +1,14 @@
 
 
+\section*{\tt \htmlref{gridCreate}{gridCreate}}
+
+\begin{verbatim}
+    INTEGER FUNCTION gridCreate(INTEGER gridtype, INTEGER size)
+\end{verbatim}
+
+Create a horizontal Grid
+
+
 \section*{\tt \htmlref{gridDefXbounds}{gridDefXbounds}}
 
 \begin{verbatim}
@@ -108,13 +117,22 @@ Define the units of a Y-axis
 Define the values of a Y-axis
 
 
+\section*{\tt \htmlref{gridDestroy}{gridDestroy}}
+
+\begin{verbatim}
+    SUBROUTINE gridDestroy(INTEGER gridID)
+\end{verbatim}
+
+Destroy a horizontal Grid
+
+
 \section*{\tt \htmlref{gridDuplicate}{gridDuplicate}}
 
 \begin{verbatim}
     INTEGER FUNCTION gridDuplicate(INTEGER gridID)
 \end{verbatim}
 
-Duplicate a grid
+Duplicate a horizontal Grid
 
 
 \section*{\tt \htmlref{gridInqSize}{gridInqSize}}
@@ -243,15 +261,6 @@ Get the units of a Y-axis
 Get all values of a Y-axis
 
 
-\section*{\tt \htmlref{gridNew}{gridNew}}
-
-\begin{verbatim}
-    INTEGER FUNCTION gridNew(INTEGER gridtype, INTEGER size)
-\end{verbatim}
-
-Create a new Grid
-
-
 \section*{\tt \htmlref{streamClose}{streamClose}}
 
 \begin{verbatim}
@@ -267,7 +276,7 @@ Close an open dataset
     INTEGER FUNCTION streamDefTimestep(INTEGER streamID, INTEGER tsID)
 \end{verbatim}
 
-Define timestep
+Define time step
 
 
 \section*{\tt \htmlref{streamDefVlist}{streamDefVlist}}
@@ -294,7 +303,7 @@ Get the filetype
     INTEGER FUNCTION streamInqTimestep(INTEGER streamID, INTEGER tsID)
 \end{verbatim}
 
-Get timestep
+Get time step
 
 
 \section*{\tt \htmlref{streamInqVlist}{streamInqVlist}}
@@ -364,6 +373,15 @@ Write a variable
 Write a horizontal slice of a variable
 
 
+\section*{\tt \htmlref{taxisCreate}{taxisCreate}}
+
+\begin{verbatim}
+    INTEGER FUNCTION taxisCreate(INTEGER taxistype)
+\end{verbatim}
+
+Create a Time axis
+
+
 \section*{\tt \htmlref{taxisDefCalendar}{taxisDefCalendar}}
 
 \begin{verbatim}
@@ -409,6 +427,15 @@ Define the verification date
 Define the verification time
 
 
+\section*{\tt \htmlref{taxisDestroy}{taxisDestroy}}
+
+\begin{verbatim}
+    SUBROUTINE taxisDestroy(INTEGER taxisID)
+\end{verbatim}
+
+Destroy a Time axis
+
+
 \section*{\tt \htmlref{taxisInqCalendar}{taxisInqCalendar}}
 
 \begin{verbatim}
@@ -454,15 +481,6 @@ Get the verification date
 Get the verification time
 
 
-\section*{\tt \htmlref{taxisNew}{taxisNew}}
-
-\begin{verbatim}
-    INTEGER FUNCTION taxisNew(INTEGER taxistype)
-\end{verbatim}
-
-Create a new T-axis
-
-
 \section*{\tt \htmlref{vlistCat}{vlistCat}}
 
 \begin{verbatim}
@@ -490,6 +508,15 @@ Copy a variable list
 Copy some entries of a variable list
 
 
+\section*{\tt \htmlref{vlistCreate}{vlistCreate}}
+
+\begin{verbatim}
+    INTEGER FUNCTION vlistCreate()
+\end{verbatim}
+
+Create a variable list
+
+
 \section*{\tt \htmlref{vlistDefVar}{vlistDefVar}}
 
 \begin{verbatim}
@@ -555,22 +582,22 @@ Define the name of a Variable
 Define the units of a Variable
 
 
-\section*{\tt \htmlref{vlistDuplicate}{vlistDuplicate}}
+\section*{\tt \htmlref{vlistDestroy}{vlistDestroy}}
 
 \begin{verbatim}
-    INTEGER FUNCTION vlistDuplicate(INTEGER vlistID)
+    SUBROUTINE vlistDestroy(INTEGER vlistID)
 \end{verbatim}
 
-Duplicate a variable list
+Destroy a variable list
 
 
-\section*{\tt \htmlref{vlistFree}{vlistFree}}
+\section*{\tt \htmlref{vlistDuplicate}{vlistDuplicate}}
 
 \begin{verbatim}
-    SUBROUTINE vlistFree(INTEGER vlistID)
+    INTEGER FUNCTION vlistDuplicate(INTEGER vlistID)
 \end{verbatim}
 
-Delete a variable list
+Duplicate a variable list
 
 
 \section*{\tt \htmlref{vlistInqVarCode}{vlistInqVarCode}}
@@ -628,15 +655,6 @@ Get the name of a Variable
 Get the units of a Variable
 
 
-\section*{\tt \htmlref{vlistNew}{vlistNew}}
-
-\begin{verbatim}
-    INTEGER FUNCTION vlistNew()
-\end{verbatim}
-
-Create a variable list
-
-
 \section*{\tt \htmlref{vlistNgrids}{vlistNgrids}}
 
 \begin{verbatim}
@@ -664,6 +682,15 @@ Number of variables in a variable list
 Number of zaxis in a variable list
 
 
+\section*{\tt \htmlref{zaxisCreate}{zaxisCreate}}
+
+\begin{verbatim}
+    INTEGER FUNCTION zaxisCreate(INTEGER zaxistype, INTEGER size)
+\end{verbatim}
+
+Create a vertical Z-axis
+
+
 \section*{\tt \htmlref{zaxisDefLevels}{zaxisDefLevels}}
 
 \begin{verbatim}
@@ -700,6 +727,15 @@ Define the name of a Z-axis
 Define the units of a Z-axis
 
 
+\section*{\tt \htmlref{zaxisDestroy}{zaxisDestroy}}
+
+\begin{verbatim}
+    SUBROUTINE zaxisDestroy(INTEGER zaxisID)
+\end{verbatim}
+
+Destroy a vertical Z-axis
+
+
 \section*{\tt \htmlref{zaxisInqLevel}{zaxisInqLevel}}
 
 \begin{verbatim}
@@ -761,12 +797,3 @@ Get the type of a Z-axis
 \end{verbatim}
 
 Get the units of a Z-axis
-
-
-\section*{\tt \htmlref{zaxisNew}{zaxisNew}}
-
-\begin{verbatim}
-    INTEGER FUNCTION zaxisNew(INTEGER zaxistype, INTEGER size)
-\end{verbatim}
-
-Create a new Z-axis
diff --git a/doc/tex/f_stream.tex b/doc/tex/f_stream.tex
index 24efa65a0..b9141239a 100644
--- a/doc/tex/f_stream.tex
+++ b/doc/tex/f_stream.tex
@@ -18,7 +18,7 @@ The name of the new dataset
 \item[{\tt filetype}]
 The type of the file format, one of the set of predefined CDI file format types.
                      The valid CDI file format types are {\tt FILETYPE\_GRB}, {\tt FILETYPE\_NC},
-                     {\tt FILETYPE\_NC2}, {\tt FILETYPE\_SRV}, and {\tt FILETYPE\_EXT}.
+                     {\tt FILETYPE\_NC2}, {\tt FILETYPE\_SRV}, {\tt FILETYPE\_EXT} and {\tt FILETYPE\_IEG}.
 
 \end{deflist}
 \end{minipage}
@@ -48,7 +48,10 @@ Library not available
 
 \subsection*{Example}
 
-Here is an example using {\tt streamOpenWrite} to create a new netCDF file named {\tt foo.nc} for writing:\begin{verbatim}
+Here is an example using {\tt streamOpenWrite} to create a new netCDF file 
+named {\tt foo.nc} for writing:
+
+\begin{lstlisting}[backgroundcolor=\color{zebg}, basicstyle=\footnotesize]
     INCLUDE 'cdi.h'
        ...
     INTEGER streamID
@@ -56,7 +59,7 @@ Here is an example using {\tt streamOpenWrite} to create a new netCDF file named
     streamID = streamOpenWrite("foo.nc", FILETYPE_NC)
     IF ( streamID .LT. 0 ) CALL handle_error(streamID)
        ...
-\end{verbatim}
+\end{lstlisting}
 
 
 \section{Open a dataset for reading: {\tt streamOpenRead}}
@@ -104,7 +107,10 @@ Library not available
 
 \subsection*{Example}
 
-Here is an example using {\tt streamOpenRead} to open an existing netCDFfile named {\tt foo.nc} for reading:\begin{verbatim}
+Here is an example using {\tt streamOpenRead} to open an existing netCDF
+file named {\tt foo.nc} for reading:
+
+\begin{lstlisting}[backgroundcolor=\color{zebg}, basicstyle=\footnotesize]
     INCLUDE 'cdi.h'
        ...
     INTEGER streamID
@@ -112,7 +118,7 @@ Here is an example using {\tt streamOpenRead} to open an existing netCDFfile nam
     streamID = streamOpenRead("foo.nc")
     IF ( streamID .LT. 0 ) CALL handle_error(streamID)
        ...
-\end{verbatim}
+\end{lstlisting}
 
 
 \section{Close an open dataset: {\tt streamClose}}
@@ -162,7 +168,7 @@ Stream identifier
 {\tt streamInqFiletype} returns the type of the file format,
 one of the set of predefined CDI file format types.
 The valid CDI file format types are {\tt FILETYPE\_GRB}, {\tt FILETYPE\_NC},
-{\tt FILETYPE\_NC2}, {\tt FILETYPE\_SRV}, and {\tt FILETYPE\_EXT}.
+{\tt FILETYPE\_NC2}, {\tt FILETYPE\_SRV}, {\tt FILETYPE\_EXT} and {\tt FILETYPE\_IEG}.
 
 
 
@@ -215,11 +221,11 @@ Stream identifier
 
 
 
-\section{Define timestep: {\tt streamDefTimestep}}
+\section{Define time step: {\tt streamDefTimestep}}
 \index{streamDefTimestep}
 \label{streamDefTimestep}
 
-The function {\tt streamDefTimestep} defines the timestep of a stream.
+The function {\tt streamDefTimestep} defines the time step of a stream.
 
 \subsection*{Usage}
 
@@ -239,15 +245,15 @@ Timestep identifier
 
 \subsection*{Result}
 
-{\tt streamDefTimestep} returns the number of records of the timestep.
+{\tt streamDefTimestep} returns the number of records of the time step.
 
 
 
-\section{Get timestep: {\tt streamInqTimestep}}
+\section{Get time step: {\tt streamInqTimestep}}
 \index{streamInqTimestep}
 \label{streamInqTimestep}
 
-The function {\tt streamInqTimestep} returns the timestep of a stream.
+The function {\tt streamInqTimestep} returns the time step of a stream.
 
 \subsection*{Usage}
 
@@ -267,13 +273,16 @@ Timestep identifier
 
 \subsection*{Result}
 
-{\tt streamInqTimestep} returns the number of records of the timestep.
+{\tt streamInqTimestep} returns the number of records of the time step.
 
 
 
 \section{Write a variable: {\tt streamWriteVar}}
 \index{streamWriteVar}
 \label{streamWriteVar}
+
+The function streamWriteVar writes the values of one time step of a variable 
+to an open dataset.
 \subsection*{Usage}
 
 \begin{verbatim}
@@ -284,11 +293,11 @@ Timestep identifier
 \hspace*{4mm}\begin{minipage}[]{15cm}
 \begin{deflist}{\tt streamID\ }
 \item[{\tt streamID}]
-Stream identifier
+Stream identifier, from a previous call to streamOpenWrite
 \item[{\tt varID}]
 Variable identifier
 \item[{\tt data}]
-Data
+Pointer to a block of data values to be written
 \item[{\tt nmiss}]
 Number of missing values
 
@@ -299,6 +308,9 @@ Number of missing values
 \section{Read a variable: {\tt streamReadVar}}
 \index{streamReadVar}
 \label{streamReadVar}
+
+The function streamReadVar reads all the values of one time step of a variable
+from an open dataset.
 \subsection*{Usage}
 
 \begin{verbatim}
@@ -309,11 +321,11 @@ Number of missing values
 \hspace*{4mm}\begin{minipage}[]{15cm}
 \begin{deflist}{\tt streamID\ }
 \item[{\tt streamID}]
-Stream identifier
+Stream identifier, from a previous call to streamOpenRead
 \item[{\tt varID}]
 Variable identifier
 \item[{\tt data}]
-Data
+Pointer to the location into which the data value is read
 \item[{\tt nmiss}]
 Number of missing values
 
@@ -324,6 +336,9 @@ Number of missing values
 \section{Write a horizontal slice of a variable: {\tt streamWriteVarSlice}}
 \index{streamWriteVarSlice}
 \label{streamWriteVarSlice}
+
+The function streamWriteVarSlice writes the values of a horizontal slice of a 
+variable to an open dataset.
 \subsection*{Usage}
 
 \begin{verbatim}
@@ -334,13 +349,13 @@ Number of missing values
 \hspace*{4mm}\begin{minipage}[]{15cm}
 \begin{deflist}{\tt streamID\ }
 \item[{\tt streamID}]
-Stream identifier
+Stream identifier, from a previous call to streamOpenWrite
 \item[{\tt varID}]
 Variable identifier
 \item[{\tt levelID}]
 Level identifier
 \item[{\tt data}]
-Data
+Pointer to a block of data values to be written
 \item[{\tt nmiss}]
 Number of missing values
 
@@ -351,6 +366,9 @@ Number of missing values
 \section{Read a horizontal slice of a variable: {\tt streamReadVarSlice}}
 \index{streamReadVarSlice}
 \label{streamReadVarSlice}
+
+The function streamReadVar reads all the values of a horizontal slice of a variable
+from an open dataset.
 \subsection*{Usage}
 
 \begin{verbatim}
@@ -361,13 +379,13 @@ Number of missing values
 \hspace*{4mm}\begin{minipage}[]{15cm}
 \begin{deflist}{\tt streamID\ }
 \item[{\tt streamID}]
-Stream identifier
+Stream identifier, from a previous call to streamOpenRead
 \item[{\tt varID}]
 Variable identifier
 \item[{\tt levelID}]
 Level identifier
 \item[{\tt data}]
-Data
+Pointer to the location into which the data value is read
 \item[{\tt nmiss}]
 Number of missing values
 
diff --git a/doc/tex/f_taxis.tex b/doc/tex/f_taxis.tex
index 5f2ff3292..a5e11bce8 100644
--- a/doc/tex/f_taxis.tex
+++ b/doc/tex/f_taxis.tex
@@ -1,15 +1,15 @@
 
 
-\section{Create a new T-axis: {\tt taxisNew}}
-\index{taxisNew}
-\label{taxisNew}
+\section{Create a Time axis: {\tt taxisCreate}}
+\index{taxisCreate}
+\label{taxisCreate}
 
-The function {\tt taxisNew} creates a new Time axis.
+The function {\tt taxisCreate} creates a Time axis.
 
 \subsection*{Usage}
 
 \begin{verbatim}
-    INTEGER FUNCTION taxisNew(INTEGER taxistype)
+    INTEGER FUNCTION taxisCreate(INTEGER taxistype)
 \end{verbatim}
 
 \hspace*{4mm}\begin{minipage}[]{15cm}
@@ -23,10 +23,28 @@ The type of the time axis, one of the set of predefined CDI time types.
 
 \subsection*{Result}
 
-{\tt taxisNew} returns an identifier to the new T-axis.
+{\tt taxisCreate} returns an identifier to the Time axis.
 
 
 
+\section{Destroy a Time axis: {\tt taxisDestroy}}
+\index{taxisDestroy}
+\label{taxisDestroy}
+\subsection*{Usage}
+
+\begin{verbatim}
+    SUBROUTINE taxisDestroy(INTEGER taxisID)
+\end{verbatim}
+
+\hspace*{4mm}\begin{minipage}[]{15cm}
+\begin{deflist}{\tt taxisID\ }
+\item[{\tt taxisID}]
+Identifier, from a previous call to {\tt taxisCreate}
+
+\end{deflist}
+\end{minipage}
+
+
 \section{Define the reference date: {\tt taxisDefRdate}}
 \index{taxisDefRdate}
 \label{taxisDefRdate}
diff --git a/doc/tex/f_vlist.tex b/doc/tex/f_vlist.tex
index 158f6adaf..4fcf085ca 100644
--- a/doc/tex/f_vlist.tex
+++ b/doc/tex/f_vlist.tex
@@ -1,28 +1,28 @@
 
 
-\section{Create a variable list: {\tt vlistNew}}
-\index{vlistNew}
-\label{vlistNew}
+\section{Create a variable list: {\tt vlistCreate}}
+\index{vlistCreate}
+\label{vlistCreate}
 \subsection*{Usage}
 
 \begin{verbatim}
-    INTEGER FUNCTION vlistNew()
+    INTEGER FUNCTION vlistCreate()
 \end{verbatim}
 
 
-\section{Delete a variable list: {\tt vlistFree}}
-\index{vlistFree}
-\label{vlistFree}
+\section{Destroy a variable list: {\tt vlistDestroy}}
+\index{vlistDestroy}
+\label{vlistDestroy}
 \subsection*{Usage}
 
 \begin{verbatim}
-    SUBROUTINE vlistFree(INTEGER vlistID)
+    SUBROUTINE vlistDestroy(INTEGER vlistID)
 \end{verbatim}
 
 \hspace*{4mm}\begin{minipage}[]{15cm}
 \begin{deflist}{\tt vlistID\ }
 \item[{\tt vlistID}]
-Identifier, from a previous call to {\tt vlistNew}
+Identifier, from a previous call to {\tt vlistCreate}
 
 \end{deflist}
 \end{minipage}
diff --git a/doc/tex/f_vlist_var.tex b/doc/tex/f_vlist_var.tex
index 4f82b56d5..5f228b7ac 100644
--- a/doc/tex/f_vlist_var.tex
+++ b/doc/tex/f_vlist_var.tex
@@ -16,11 +16,11 @@ The function {\tt vlistDefVar} adds a new variable to vlistID.
 \hspace*{4mm}\begin{minipage}[]{15cm}
 \begin{deflist}{\tt vlistID\ }
 \item[{\tt vlistID}]
-Variable list ID, from a previous call to vlistNew or vlistCopy
+Variable list ID, from a previous call to vlistCreate or vlistCopy
 \item[{\tt gridID}]
-Grid ID, from a previous call to gridNew
+Grid ID, from a previous call to gridCreate
 \item[{\tt zaxisID}]
-Z-axis ID, from a previous call to zaxisNew
+Z-axis ID, from a previous call to zaxisCreate
 \item[{\tt timeID}]
 One of the set of predefined CDI time identifiers.
                      The valid CDI time identifiers are TIME\_CONSTANT and TIME\_VARIABLE.
diff --git a/doc/tex/f_zaxis.tex b/doc/tex/f_zaxis.tex
index 52f554c25..71b10f5b7 100644
--- a/doc/tex/f_zaxis.tex
+++ b/doc/tex/f_zaxis.tex
@@ -1,15 +1,15 @@
 
 
-\section{Create a new Z-axis: {\tt zaxisNew}}
-\index{zaxisNew}
-\label{zaxisNew}
+\section{Create a vertical Z-axis: {\tt zaxisCreate}}
+\index{zaxisCreate}
+\label{zaxisCreate}
 
-The function {\tt zaxisNew} creates a new Z-axis.
+The function {\tt zaxisCreate} creates a vertical Z-axis.
 
 \subsection*{Usage}
 
 \begin{verbatim}
-    INTEGER FUNCTION zaxisNew(INTEGER zaxistype, INTEGER size)
+    INTEGER FUNCTION zaxisCreate(INTEGER zaxistype, INTEGER size)
 \end{verbatim}
 
 \hspace*{4mm}\begin{minipage}[]{15cm}
@@ -27,10 +27,28 @@ Number of levels
 
 \subsection*{Result}
 
-{\tt zaxisNew} returns an identifier to the new Z-axis.
+{\tt zaxisCreate} returns an identifier to the vertical Z-axis.
 
 
 
+\section{Destroy a vertical Z-axis: {\tt zaxisDestroy}}
+\index{zaxisDestroy}
+\label{zaxisDestroy}
+\subsection*{Usage}
+
+\begin{verbatim}
+    SUBROUTINE zaxisDestroy(INTEGER zaxisID)
+\end{verbatim}
+
+\hspace*{4mm}\begin{minipage}[]{15cm}
+\begin{deflist}{\tt zaxisID\ }
+\item[{\tt zaxisID}]
+Identifier, from a previous call to {\tt zaxisCreate}
+
+\end{deflist}
+\end{minipage}
+
+
 \section{Get the type of a Z-axis: {\tt zaxisInqType}}
 \index{zaxisInqType}
 \label{zaxisInqType}
diff --git a/doc/tex/formats.tex b/doc/tex/formats.tex
index 3b2790e45..0ee69da1e 100644
--- a/doc/tex/formats.tex
+++ b/doc/tex/formats.tex
@@ -6,16 +6,20 @@ over an unlimited number of time steps.
 
 \section{netCDF}
 
-NetCDF (network Common Data Form) is an interface for array-oriented data
+\htmlref{NetCDF}{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 supports only 2D, 3D and 4D arrays and the attributes must 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}).
 
-%ncdap
+\subsection{ncdap}
 
 
 \section{SERVICE}
@@ -31,10 +35,10 @@ The following Fortran code example can be used to read a
 SERVICE record with an accuarcy of 4 bytes:
 
 \begin{lstlisting}[backgroundcolor=\color{zebg}, basicstyle=\footnotesize]
-   INTEGER*4 icode, ilevel, idate, itime, nlon, nlat, idispo1, idispo2
+   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) icode,ilevel,idate,itime,nlon,nlat,idispo1,idispo2
    READ(unit) ((field(ilon,ilat), ilon=1,nlon), ilat=1,nlat)
 \end{lstlisting}
 
@@ -68,10 +72,10 @@ The following Fortran code example can be used to read an
 EXTRA record with an accuarcy of 4 bytes:
 
 \begin{lstlisting}[backgroundcolor=\color{zebg}, basicstyle=\footnotesize]
-   INTEGER*4 idate, icode, ilevel, nsize
+   INTEGER*4 idate,icode,ilevel,nsize
    REAL*4 field(msize)
-
-   READ(unit) idate, icode, ilevel, nsize
+      ...
+   READ(unit) idate,icode,ilevel,nsize
    READ(unit) (field(isize),isize=1,nsize)
 \end{lstlisting}
 
@@ -91,10 +95,10 @@ The meaning of the variables are:
 
 \section{IEG}
 
-IEG is the standard output format of the regional model \htmlref{REMO}{REMO}.
+IEG is the standard binary output format of the regional model \htmlref{REMO}{REMO}.
 It is simple an unpacked GRIB format. The product and grid
-description section are coded with 32 bit integer values and the
-data section can have 32 or 64 bit IEEE floating point values.
+description section 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.
 CDI supports only data on an rotated grid for the IEG format.
diff --git a/doc/tex/makedoc b/doc/tex/makedoc
index 90638dc7c..49458ae5a 100755
--- a/doc/tex/makedoc
+++ b/doc/tex/makedoc
@@ -236,12 +236,14 @@ while (<MOFILE>) {
 	($kword) = split(" ", $tag, 1);
 	$kword = uc($kword);
 	if ( "$kword" eq "\@SOURCE" ) {
-	  printcfdoc ("\\begin{verbatim}\n");
+#	  printcfdoc ("\\begin{verbatim}\n");
+	  printcfdoc ("\\begin{lstlisting}[backgroundcolor=\\color{zebg}, basicstyle=\\footnotesize]\n");
 	  $source = 1;
 	  next;
 	}
 	if ( "$kword" eq "\@ENDSOURCE" ) {
-	  printcfdoc ("\\end{verbatim}\n");
+#	  printcfdoc ("\\end{verbatim}\n");
+	  printcfdoc ("\\end{lstlisting}\n");
 	  $source = 0;
 	  next;
 	}
@@ -399,9 +401,10 @@ sub printcfdoc {
   @list = @_;
   if ( $#list >= 0 ) {
     foreach $tag (@list) {
+      chomp $tag;
       $tag =~ s/_/\\_/og;
-      print CDOCFILE "$tag";
-      print FDOCFILE "$tag";
+      print CDOCFILE "$tag\n";
+      print FDOCFILE "$tag\n";
     }
   }
 }
diff --git a/doc/tex/usage.tex b/doc/tex/usage.tex
index b88934998..f6fdcc3fc 100644
--- a/doc/tex/usage.tex
+++ b/doc/tex/usage.tex
@@ -2,16 +2,16 @@
 
 Here is a typical sequence of CDI calls used to create a new dataset:
 
-\begin{verbatim}
-    gridNew              ! define a grid: from type and size
+\begin{lstlisting}[backgroundcolor=\color{zebg}, basicstyle=\footnotesize]
+    gridCreate           ! create a horizontal Grid: from type and size
        ...
-    zaxisNew             ! define a Z-axis: from type and size
+    zaxisCreate          ! create a vertical Z-axis: from type and size
        ...
-    taxisNew             ! define a T-axis: from type
+    taxisCreate          ! create a Time axis: from type
        ...
-    vlistNew             ! create a variable list
+    vlistCreate          ! create a variable list
           ...
-       vlistDefVar       ! define variables: from grid and Z-axis
+       vlistDefVar       ! define variables: from Grid and Z-axis
           ...
     streamOpenWrite      ! create a dataset: from name and file type
        ...
@@ -22,28 +22,36 @@ Here is a typical sequence of CDI calls used to create a new dataset:
        streamWriteVar    ! write variable
           ...
     streamClose          ! close the dataset
-\end{verbatim}
+       ...
+    vlistDestroy         ! destroy the variable list
+       ...
+    taxisDestroy         ! destroy the Time axis
+       ...
+    zaxisDestroy         ! destroy the Z-axis
+       ...
+    gridDestroy          ! destroy the Grid
+\end{lstlisting}
 
 
 \section{Reading a dataset}
 
-\begin{verbatim}
+\begin{lstlisting}[backgroundcolor=\color{zebg}, basicstyle=\footnotesize]
     streamOpenRead       ! open existing dataset
        ...
     streamInqVlist       ! find out what is in it
           ...
-       vlistInqVarGrid   ! get grid
+       vlistInqVarGrid   ! get an identifier to the Grid
           ...
-       vlistInqVarZaxis  ! get Z-axis
+       vlistInqVarZaxis  ! get an identifier to the Z-axis
           ...
-       vlistInqTaxis     ! get T-axis
+       vlistInqTaxis     ! get an identifier to the T-axis
           ...
     streamInqTimestep    ! get time step
           ...
        streamReadVar     ! read varible
           ...
     streamClose          ! close the dataset
-\end{verbatim}
+\end{lstlisting}
 
 
 \section{Compiling and Linking with the CDI library}
diff --git a/examples/Makefile.am b/examples/Makefile.am
new file mode 100644
index 000000000..725767ab9
--- /dev/null
+++ b/examples/Makefile.am
@@ -0,0 +1,16 @@
+## Process this file with automake to produce Makefile.in
+#
+bin_PROGRAMS = cdi_write cdi_read cdi_copy
+#
+cdi_write_SOURCES = cdi_write.c
+cdi_write_LDADD = $(top_srcdir)/src/libcdi.a $(LDFLAGS) -lm
+#
+cdi_read_SOURCES = cdi_read.c
+cdi_read_LDADD = $(top_srcdir)/src/libcdi.a $(LDFLAGS) -lm
+#
+cdi_copy_SOURCES = cdi_copy.c
+cdi_copy_LDADD = $(top_srcdir)/src/libcdi.a $(LDFLAGS) -lm
+#
+CPPFLAGS = -I$(top_srcdir)/src
+#
+CLEANFILES  = `ls *~`
diff --git a/examples/Makefile.in b/examples/Makefile.in
new file mode 100644
index 000000000..1690b78ff
--- /dev/null
+++ b/examples/Makefile.in
@@ -0,0 +1,349 @@
+# Makefile.in generated by automake 1.6.3 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+
+EXEEXT = @EXEEXT@
+OBJEXT = @OBJEXT@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+AMTAR = @AMTAR@
+AR = @AR@
+AWK = @AWK@
+CC = @CC@
+CFINT = @CFINT@
+#
+CPPFLAGS = -I$(top_srcdir)/src
+DEPDIR = @DEPDIR@
+F77 = @F77@
+FC = @FC@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+PACKAGE = @PACKAGE@
+RANLIB = @RANLIB@
+STRIP = @STRIP@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+install_sh = @install_sh@
+
+#
+bin_PROGRAMS = cdi_write cdi_read cdi_copy
+#
+cdi_write_SOURCES = cdi_write.c
+cdi_write_LDADD = $(top_srcdir)/src/libcdi.a $(LDFLAGS) -lm
+#
+cdi_read_SOURCES = cdi_read.c
+cdi_read_LDADD = $(top_srcdir)/src/libcdi.a $(LDFLAGS) -lm
+#
+cdi_copy_SOURCES = cdi_copy.c
+cdi_copy_LDADD = $(top_srcdir)/src/libcdi.a $(LDFLAGS) -lm
+#
+CLEANFILES = `ls *~`
+subdir = examples
+mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/src/config.h
+CONFIG_CLEAN_FILES =
+bin_PROGRAMS = cdi_write$(EXEEXT) cdi_read$(EXEEXT) cdi_copy$(EXEEXT)
+PROGRAMS = $(bin_PROGRAMS)
+
+am_cdi_copy_OBJECTS = cdi_copy.$(OBJEXT)
+cdi_copy_OBJECTS = $(am_cdi_copy_OBJECTS)
+cdi_copy_DEPENDENCIES = $(top_srcdir)/src/libcdi.a
+cdi_copy_LDFLAGS =
+am_cdi_read_OBJECTS = cdi_read.$(OBJEXT)
+cdi_read_OBJECTS = $(am_cdi_read_OBJECTS)
+cdi_read_DEPENDENCIES = $(top_srcdir)/src/libcdi.a
+cdi_read_LDFLAGS =
+am_cdi_write_OBJECTS = cdi_write.$(OBJEXT)
+cdi_write_OBJECTS = $(am_cdi_write_OBJECTS)
+cdi_write_DEPENDENCIES = $(top_srcdir)/src/libcdi.a
+cdi_write_LDFLAGS =
+
+DEFS = @DEFS@
+DEFAULT_INCLUDES =  -I. -I$(srcdir) -I$(top_builddir)/src
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+depcomp = $(SHELL) $(top_srcdir)/config/depcomp
+am__depfiles_maybe = depfiles
+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/cdi_copy.Po ./$(DEPDIR)/cdi_read.Po \
+@AMDEP_TRUE@	./$(DEPDIR)/cdi_write.Po
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+CFLAGS = @CFLAGS@
+DIST_SOURCES = $(cdi_copy_SOURCES) $(cdi_read_SOURCES) \
+	$(cdi_write_SOURCES)
+DIST_COMMON = Makefile.am Makefile.in
+SOURCES = $(cdi_copy_SOURCES) $(cdi_read_SOURCES) $(cdi_write_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in:  Makefile.am  $(top_srcdir)/configure.ac $(ACLOCAL_M4)
+	cd $(top_srcdir) && \
+	  $(AUTOMAKE) --gnu  examples/Makefile
+Makefile:  $(srcdir)/Makefile.in  $(top_builddir)/config.status
+	cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
+install-binPROGRAMS: $(bin_PROGRAMS)
+	@$(NORMAL_INSTALL)
+	$(mkinstalldirs) $(DESTDIR)$(bindir)
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+	  if test -f $$p \
+	  ; then \
+	    f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
+	   echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \
+	   $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f; \
+	  else :; fi; \
+	done
+
+uninstall-binPROGRAMS:
+	@$(NORMAL_UNINSTALL)
+	@list='$(bin_PROGRAMS)'; for p in $$list; do \
+	  f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
+	  echo " rm -f $(DESTDIR)$(bindir)/$$f"; \
+	  rm -f $(DESTDIR)$(bindir)/$$f; \
+	done
+
+clean-binPROGRAMS:
+	-test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+cdi_copy$(EXEEXT): $(cdi_copy_OBJECTS) $(cdi_copy_DEPENDENCIES) 
+	@rm -f cdi_copy$(EXEEXT)
+	$(LINK) $(cdi_copy_LDFLAGS) $(cdi_copy_OBJECTS) $(cdi_copy_LDADD) $(LIBS)
+cdi_read$(EXEEXT): $(cdi_read_OBJECTS) $(cdi_read_DEPENDENCIES) 
+	@rm -f cdi_read$(EXEEXT)
+	$(LINK) $(cdi_read_LDFLAGS) $(cdi_read_OBJECTS) $(cdi_read_LDADD) $(LIBS)
+cdi_write$(EXEEXT): $(cdi_write_OBJECTS) $(cdi_write_DEPENDENCIES) 
+	@rm -f cdi_write$(EXEEXT)
+	$(LINK) $(cdi_write_LDFLAGS) $(cdi_write_OBJECTS) $(cdi_write_LDADD) $(LIBS)
+
+mostlyclean-compile:
+	-rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+	-rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_copy.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_read.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cdi_write.Po@am__quote@
+
+distclean-depend:
+	-rm -rf ./$(DEPDIR)
+
+.c.o:
+@AMDEP_TRUE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
+
+.c.obj:
+@AMDEP_TRUE@	source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@	depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@	$(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+	$(COMPILE) -c `cygpath -w $<`
+CCDEPMODE = @CCDEPMODE@
+uninstall-info-am:
+
+ETAGS = etags
+ETAGSFLAGS =
+
+tags: TAGS
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+	list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	mkid -fID $$unique
+
+TAGS:  $(HEADERS) $(SOURCES)  $(TAGS_DEPENDENCIES) \
+		$(TAGS_FILES) $(LISP)
+	tags=; \
+	here=`pwd`; \
+	list='$(SOURCES) $(HEADERS)  $(LISP) $(TAGS_FILES)'; \
+	unique=`for i in $$list; do \
+	    if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+	  done | \
+	  $(AWK) '    { files[$$0] = 1; } \
+	       END { for (i in files) print i; }'`; \
+	test -z "$(ETAGS_ARGS)$$tags$$unique" \
+	  || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+	     $$tags $$unique
+
+GTAGS:
+	here=`$(am__cd) $(top_builddir) && pwd` \
+	  && cd $(top_srcdir) \
+	  && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+	-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+	@list='$(DISTFILES)'; for file in $$list; do \
+	  if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+	  dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+	  if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+	    dir="/$$dir"; \
+	    $(mkinstalldirs) "$(distdir)$$dir"; \
+	  else \
+	    dir=''; \
+	  fi; \
+	  if test -d $$d/$$file; then \
+	    if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+	      cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+	    fi; \
+	    cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+	  else \
+	    test -f $(distdir)/$$file \
+	    || cp -p $$d/$$file $(distdir)/$$file \
+	    || exit 1; \
+	  fi; \
+	done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+
+installdirs:
+	$(mkinstalldirs) $(DESTDIR)$(bindir)
+
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+	@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+	$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+	  INSTALL_STRIP_FLAG=-s \
+	  `test -z '$(STRIP)' || \
+	    echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+	-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
+
+distclean-generic:
+	-rm -f Makefile $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+	@echo "This command is intended for maintainers to use"
+	@echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+
+distclean-am: clean-am distclean-compile distclean-depend \
+	distclean-generic distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+uninstall-am: uninstall-binPROGRAMS uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-binPROGRAMS \
+	clean-generic distclean distclean-compile distclean-depend \
+	distclean-generic distclean-tags distdir dvi dvi-am info \
+	info-am install install-am install-binPROGRAMS install-data \
+	install-data-am install-exec install-exec-am install-info \
+	install-info-am install-man install-strip installcheck \
+	installcheck-am installdirs maintainer-clean \
+	maintainer-clean-generic mostlyclean mostlyclean-compile \
+	mostlyclean-generic tags uninstall uninstall-am \
+	uninstall-binPROGRAMS uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/examples/cdi_copy.c b/examples/cdi_copy.c
new file mode 100644
index 000000000..a797aa1e4
--- /dev/null
+++ b/examples/cdi_copy.c
@@ -0,0 +1,86 @@
+#include "cdi.h"
+
+#define NLON  12 /* Number of longitudes */
+#define NLAT   6 /* Number of latitudes  */
+#define NLEV   5 /* Number of levels     */
+#define NTIME  3 /* Number of time steps */
+
+int main(void)
+{
+  int gridID, zaxisID1, zaxisID2, taxisID;
+  int vlistID, varID1, varID2, streamID;
+  int tsID;
+  int i, nmiss = 0;
+  double lons[NLON] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330};
+  double lats[NLAT] = {-75, -45, -15, 15, 45, 75};
+  double levs[NLEV] = {101300, 92500, 85000, 50000, 20000};
+  double var1[NLON*NLAT];
+  double var2[NLON*NLAT*NLEV];
+
+  /* Create a LONLAT grid */
+  gridID  = gridCreate(GRID_LONLAT, NLON*NLAT);
+  gridDefXsize(gridID, NLON);
+  gridDefYsize(gridID, NLAT);
+  gridDefXvals(gridID, lons);
+  gridDefYvals(gridID, lats);
+
+  /* Create a surface Z-axis */
+  zaxisID1 = zaxisCreate(ZAXIS_SURFACE, 1);
+
+  /* Create a pressure level Z-axis */
+  zaxisID2 = zaxisCreate(ZAXIS_PRESSURE, NLEV);
+  zaxisDefLevels(zaxisID2, levs);
+ 
+  /* Create a variable list */
+  vlistID = vlistCreate();
+
+  /* Define the variables */
+  varID1  = vlistDefVar(vlistID, gridID, zaxisID1, TIME_VARIABLE);
+  varID2  = vlistDefVar(vlistID, gridID, zaxisID2, TIME_VARIABLE);
+
+  /* Define variable name */
+  vlistDefVarName(vlistID, varID1, "varname1");
+  vlistDefVarName(vlistID, varID2, "varname2");
+
+  /* Create a Time axis */
+  taxisID = taxisCreate(TAXIS_ABSOLUTE);
+
+  /* Assign the Time axis to the variable list */
+  vlistDefTaxis(vlistID, taxisID);
+
+  /* Create a dataset */
+  streamID  = streamOpenWrite("example.nc", FILETYPE_NC);
+
+  /* Assign the variable list to the dataset */
+  streamDefVlist(streamID, vlistID);
+
+  /* Loop over the number of time steps */
+  for ( tsID = 0; tsID < NTIME; tsID++ )
+    {
+      /* Set the verification date to 1985-01-01 + tsID */
+      taxisDefVdate(taxisID, 19850101+tsID);
+      /* Set the verification time to 12:00 */
+      taxisDefVtime(taxisID, 1200);
+      /* Define the time step */
+      streamDefTimestep(streamID, tsID);
+
+      /* Write var1 */
+      for ( i = 0; i < NLON*NLAT; i++ ) var1[i] = 1;
+      streamWriteVar(streamID, varID1, var1, nmiss);
+      /* Write var2 */
+      for ( i = 0; i < NLON*NLAT*NLEV; i++ ) var2[i] = 2;
+      streamWriteVar(streamID, varID2, var2, nmiss);
+    }
+
+  /* Close the output stream */
+  streamClose(streamID);
+
+  /* Destroy the created objects */
+  vlistDestroy(vlistID);
+  taxisDestroy(taxisID);
+  zaxisDestroy(zaxisID1);
+  zaxisDestroy(zaxisID2);
+  gridDestroy(gridID);
+
+  return 0;
+}
diff --git a/examples/cdi_read.c b/examples/cdi_read.c
new file mode 100644
index 000000000..a797aa1e4
--- /dev/null
+++ b/examples/cdi_read.c
@@ -0,0 +1,86 @@
+#include "cdi.h"
+
+#define NLON  12 /* Number of longitudes */
+#define NLAT   6 /* Number of latitudes  */
+#define NLEV   5 /* Number of levels     */
+#define NTIME  3 /* Number of time steps */
+
+int main(void)
+{
+  int gridID, zaxisID1, zaxisID2, taxisID;
+  int vlistID, varID1, varID2, streamID;
+  int tsID;
+  int i, nmiss = 0;
+  double lons[NLON] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330};
+  double lats[NLAT] = {-75, -45, -15, 15, 45, 75};
+  double levs[NLEV] = {101300, 92500, 85000, 50000, 20000};
+  double var1[NLON*NLAT];
+  double var2[NLON*NLAT*NLEV];
+
+  /* Create a LONLAT grid */
+  gridID  = gridCreate(GRID_LONLAT, NLON*NLAT);
+  gridDefXsize(gridID, NLON);
+  gridDefYsize(gridID, NLAT);
+  gridDefXvals(gridID, lons);
+  gridDefYvals(gridID, lats);
+
+  /* Create a surface Z-axis */
+  zaxisID1 = zaxisCreate(ZAXIS_SURFACE, 1);
+
+  /* Create a pressure level Z-axis */
+  zaxisID2 = zaxisCreate(ZAXIS_PRESSURE, NLEV);
+  zaxisDefLevels(zaxisID2, levs);
+ 
+  /* Create a variable list */
+  vlistID = vlistCreate();
+
+  /* Define the variables */
+  varID1  = vlistDefVar(vlistID, gridID, zaxisID1, TIME_VARIABLE);
+  varID2  = vlistDefVar(vlistID, gridID, zaxisID2, TIME_VARIABLE);
+
+  /* Define variable name */
+  vlistDefVarName(vlistID, varID1, "varname1");
+  vlistDefVarName(vlistID, varID2, "varname2");
+
+  /* Create a Time axis */
+  taxisID = taxisCreate(TAXIS_ABSOLUTE);
+
+  /* Assign the Time axis to the variable list */
+  vlistDefTaxis(vlistID, taxisID);
+
+  /* Create a dataset */
+  streamID  = streamOpenWrite("example.nc", FILETYPE_NC);
+
+  /* Assign the variable list to the dataset */
+  streamDefVlist(streamID, vlistID);
+
+  /* Loop over the number of time steps */
+  for ( tsID = 0; tsID < NTIME; tsID++ )
+    {
+      /* Set the verification date to 1985-01-01 + tsID */
+      taxisDefVdate(taxisID, 19850101+tsID);
+      /* Set the verification time to 12:00 */
+      taxisDefVtime(taxisID, 1200);
+      /* Define the time step */
+      streamDefTimestep(streamID, tsID);
+
+      /* Write var1 */
+      for ( i = 0; i < NLON*NLAT; i++ ) var1[i] = 1;
+      streamWriteVar(streamID, varID1, var1, nmiss);
+      /* Write var2 */
+      for ( i = 0; i < NLON*NLAT*NLEV; i++ ) var2[i] = 2;
+      streamWriteVar(streamID, varID2, var2, nmiss);
+    }
+
+  /* Close the output stream */
+  streamClose(streamID);
+
+  /* Destroy the created objects */
+  vlistDestroy(vlistID);
+  taxisDestroy(taxisID);
+  zaxisDestroy(zaxisID1);
+  zaxisDestroy(zaxisID2);
+  gridDestroy(gridID);
+
+  return 0;
+}
diff --git a/examples/cdi_write.c b/examples/cdi_write.c
new file mode 100644
index 000000000..a797aa1e4
--- /dev/null
+++ b/examples/cdi_write.c
@@ -0,0 +1,86 @@
+#include "cdi.h"
+
+#define NLON  12 /* Number of longitudes */
+#define NLAT   6 /* Number of latitudes  */
+#define NLEV   5 /* Number of levels     */
+#define NTIME  3 /* Number of time steps */
+
+int main(void)
+{
+  int gridID, zaxisID1, zaxisID2, taxisID;
+  int vlistID, varID1, varID2, streamID;
+  int tsID;
+  int i, nmiss = 0;
+  double lons[NLON] = {0, 30, 60, 90, 120, 150, 180, 210, 240, 270, 300, 330};
+  double lats[NLAT] = {-75, -45, -15, 15, 45, 75};
+  double levs[NLEV] = {101300, 92500, 85000, 50000, 20000};
+  double var1[NLON*NLAT];
+  double var2[NLON*NLAT*NLEV];
+
+  /* Create a LONLAT grid */
+  gridID  = gridCreate(GRID_LONLAT, NLON*NLAT);
+  gridDefXsize(gridID, NLON);
+  gridDefYsize(gridID, NLAT);
+  gridDefXvals(gridID, lons);
+  gridDefYvals(gridID, lats);
+
+  /* Create a surface Z-axis */
+  zaxisID1 = zaxisCreate(ZAXIS_SURFACE, 1);
+
+  /* Create a pressure level Z-axis */
+  zaxisID2 = zaxisCreate(ZAXIS_PRESSURE, NLEV);
+  zaxisDefLevels(zaxisID2, levs);
+ 
+  /* Create a variable list */
+  vlistID = vlistCreate();
+
+  /* Define the variables */
+  varID1  = vlistDefVar(vlistID, gridID, zaxisID1, TIME_VARIABLE);
+  varID2  = vlistDefVar(vlistID, gridID, zaxisID2, TIME_VARIABLE);
+
+  /* Define variable name */
+  vlistDefVarName(vlistID, varID1, "varname1");
+  vlistDefVarName(vlistID, varID2, "varname2");
+
+  /* Create a Time axis */
+  taxisID = taxisCreate(TAXIS_ABSOLUTE);
+
+  /* Assign the Time axis to the variable list */
+  vlistDefTaxis(vlistID, taxisID);
+
+  /* Create a dataset */
+  streamID  = streamOpenWrite("example.nc", FILETYPE_NC);
+
+  /* Assign the variable list to the dataset */
+  streamDefVlist(streamID, vlistID);
+
+  /* Loop over the number of time steps */
+  for ( tsID = 0; tsID < NTIME; tsID++ )
+    {
+      /* Set the verification date to 1985-01-01 + tsID */
+      taxisDefVdate(taxisID, 19850101+tsID);
+      /* Set the verification time to 12:00 */
+      taxisDefVtime(taxisID, 1200);
+      /* Define the time step */
+      streamDefTimestep(streamID, tsID);
+
+      /* Write var1 */
+      for ( i = 0; i < NLON*NLAT; i++ ) var1[i] = 1;
+      streamWriteVar(streamID, varID1, var1, nmiss);
+      /* Write var2 */
+      for ( i = 0; i < NLON*NLAT*NLEV; i++ ) var2[i] = 2;
+      streamWriteVar(streamID, varID2, var2, nmiss);
+    }
+
+  /* Close the output stream */
+  streamClose(streamID);
+
+  /* Destroy the created objects */
+  vlistDestroy(vlistID);
+  taxisDestroy(taxisID);
+  zaxisDestroy(zaxisID1);
+  zaxisDestroy(zaxisID2);
+  gridDestroy(gridID);
+
+  return 0;
+}
diff --git a/prog/Makefile.am b/prog/Makefile.am
index 66c48ef68..1774a8d9d 100644
--- a/prog/Makefile.am
+++ b/prog/Makefile.am
@@ -4,11 +4,11 @@ bin_PROGRAMS = cdi createtable
 #
 cdi_SOURCES = cdi.c
 #
-cdi_LDADD = ../src/libcdi.a $(LDFLAGS) -lm
+cdi_LDADD = $(top_srcdir)/src/libcdi.a $(LDFLAGS) -lm
 #
 createtable_SOURCES = createtable.c
 #
-createtable_LDADD = ../src/libcdi.a $(LDFLAGS) -lm
+createtable_LDADD = $(top_srcdir)/src/libcdi.a $(LDFLAGS) -lm
 #
 CPPFLAGS = -I$(top_srcdir)/src
 #
diff --git a/prog/Makefile.in b/prog/Makefile.in
index d86db0155..494c04155 100644
--- a/prog/Makefile.in
+++ b/prog/Makefile.in
@@ -87,11 +87,11 @@ bin_PROGRAMS = cdi createtable
 #
 cdi_SOURCES = cdi.c
 #
-cdi_LDADD = ../src/libcdi.a $(LDFLAGS) -lm
+cdi_LDADD = $(top_srcdir)/src/libcdi.a $(LDFLAGS) -lm
 #
 createtable_SOURCES = createtable.c
 #
-createtable_LDADD = ../src/libcdi.a $(LDFLAGS) -lm
+createtable_LDADD = $(top_srcdir)/src/libcdi.a $(LDFLAGS) -lm
 #
 CLEANFILES = `ls *~`
 subdir = prog
@@ -103,11 +103,11 @@ PROGRAMS = $(bin_PROGRAMS)
 
 am_cdi_OBJECTS = cdi.$(OBJEXT)
 cdi_OBJECTS = $(am_cdi_OBJECTS)
-cdi_DEPENDENCIES = ../src/libcdi.a
+cdi_DEPENDENCIES = $(top_srcdir)/src/libcdi.a
 cdi_LDFLAGS =
 am_createtable_OBJECTS = createtable.$(OBJEXT)
 createtable_OBJECTS = $(am_createtable_OBJECTS)
-createtable_DEPENDENCIES = ../src/libcdi.a
+createtable_DEPENDENCIES = $(top_srcdir)/src/libcdi.a
 createtable_LDFLAGS =
 
 DEFS = @DEFS@
diff --git a/src/cdi.h b/src/cdi.h
index acdc4d3aa..a14f2cb98 100644
--- a/src/cdi.h
+++ b/src/cdi.h
@@ -127,11 +127,16 @@ void    streamDefVlist(int streamID, int vlistID);
 /*      streamInqVlist: Get the Vlist of a stream */
 int     streamInqVlist(int streamID);
 
+/*      streamInqFiletype: Get the filetype */
 int     streamInqFiletype(int streamID);
+
 void    streamDefByteorder(int streamID, int byteorder);
 int     streamInqByteorder(int streamID);
 
+/*      streamDefTimestep: Define time step */
 int     streamDefTimestep(int streamID, int tsID);
+
+/*      streamInqTimestep: Get time step */
 int     streamInqTimestep(int streamID, int tsID);
 
 char   *streamFilename(int streamID);
@@ -169,7 +174,7 @@ void    streamInqGinfo(int streamID, int *intnum, float *fltnum);
 /*      vlistCreate: Create a variable list */
 int     vlistCreate(void);
 
-/*      vlistDestroy: Delete a variable list */
+/*      vlistDestroy: Destroy a variable list */
 void    vlistDestroy(int vlistID);
 
 /*      vlistDuplicate: Duplicate a variable list */
@@ -308,9 +313,12 @@ int     gridInqMask(int gridID, int *mask);
 void    gridPrint(int gridID);
 int     gridSize(void);
 
-/*      gridCreate: Create a new Grid */
+/*      gridCreate: Create a horizontal Grid */
 int     gridCreate(int gridtype, int size);
 
+/*      gridDestroy: Destroy a horizontal Grid */
+void    gridDestroy(int gridID);
+
 /*      gridDuplicate: Duplicate a Grid */
 int     gridDuplicate(int gridID);
 
@@ -453,9 +461,12 @@ int     gridToCurvilinear(int gridID);
 
 void    zaxisName(int zaxistype, char *gridname);
 
-/*      zaxisCreate: Create a new Z-axis */
+/*      zaxisCreate: Create a vertical Z-axis */
 int     zaxisCreate(int leveltype, int size);
 
+/*      zaxisDestroy: Destroy a vertical Z-axis */
+void    zaxisDestroy(int zaxisID);
+
 /*      zaxisInqType: Get the type of a Z-axis */
 int     zaxisInqType(int zaxisID);
 
@@ -519,9 +530,12 @@ void    zaxisChangeType(int zaxisID, int leveltype);
 
 /* TAXIS routines */
 
-/*      taxisCreate: Create a new T-axis */
+/*      taxisCreate: Create a Time axis */
 int     taxisCreate(int timetype);
 
+/*      taxisDestroy: Destroy a Time axis */
+void    taxisDestroy(int taxisID);
+
 int     taxisDuplicate(int taxisID);
 
 void    taxisCopyTimestep(int taxisIDdes, int taxisIDsrc);
diff --git a/src/grid.c b/src/grid.c
index 5fe188cb5..716e8eb85 100644
--- a/src/grid.c
+++ b/src/grid.c
@@ -557,7 +557,7 @@ static void defineYvals(int gridID)
 
 /*
 @Function  gridCreate
-@Title     Create a new Grid
+@Title     Create a horizontal Grid
 
 @Prototype int gridCreate(int gridtype, int size)
 @Parameter
@@ -567,13 +567,13 @@ static void defineYvals(int gridID)
     @Item  size      Number of gridpoints.
 
 @Description
-The function {\tt gridCreate} creates a new Grid.
+The function {\tt gridCreate} creates a horizontal Grid.
 
 @Result
-{\tt gridCreate} returns an identifier to the new Grid.
+{\tt gridCreate} returns an identifier to the Grid.
 
 @Example
-Here is an example using {\tt gridCreate} to create a new {\tt LONLAT} Grid:
+Here is an example using {\tt gridCreate} to create a {\tt LONLAT} Grid:
 
 @Source
 #include <cdi.h>
@@ -669,6 +669,21 @@ int gridCreate(int gridtype, int size)
 }
 
 
+/*
+@Function  gridDestroy
+@Title     Destroy a horizontal Grid
+
+@Prototype void gridDestroy(int gridID)
+@Parameter
+    @Item  gridID Identifier, from a previous call to {\tt gridCreate}
+
+@EndFunction
+*/
+void gridDestroy(int gridID)
+{
+}
+
+
 char *gridNamePtr(int gridtype)
 {
   char *name;
@@ -2313,7 +2328,7 @@ int gridGenerate(GRID grid)
 
 /*
 @Function  gridDuplicate
-@Title     Duplicate a grid
+@Title     Duplicate a horizontal Grid
 
 @Prototype int gridDuplicate(int gridID)
 @Parameter
@@ -2321,10 +2336,10 @@ int gridGenerate(GRID grid)
                    {\tt gridDuplicate} or {\tt vlistInqVarGrid}.
 
 @Description
-The function {\tt gridDuplicate} duplicates a grid.
+The function {\tt gridDuplicate} duplicates a horizontal Grid.
 
 @Result
-{\tt gridDuplicate} returns an identifier to the duplicated grid.
+{\tt gridDuplicate} returns an identifier to the duplicated Grid.
 
 @EndFunction
 */
diff --git a/src/stream.c b/src/stream.c
index 691baf557..c0d4ce3c2 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -195,7 +195,7 @@ The function {\tt streamInqFiletype} returns the filetype of a stream.
 {\tt streamInqFiletype} returns the type of the file format,
 one of the set of predefined CDI file format types.
 The valid CDI file format types are {\tt FILETYPE_GRB}, {\tt FILETYPE_NC},
-{\tt FILETYPE_NC2}, {\tt FILETYPE_SRV}, and {\tt FILETYPE_EXT}.
+{\tt FILETYPE_NC2}, {\tt FILETYPE_SRV}, {\tt FILETYPE_EXT} and {\tt FILETYPE_IEG}.
 
 @EndFunction
 */
@@ -817,7 +817,7 @@ int streamOpenAppend(const char *filename)
     @Item  path      The name of the new dataset
     @Item  filetype  The type of the file format, one of the set of predefined CDI file format types.
                      The valid CDI file format types are {\tt FILETYPE_GRB}, {\tt FILETYPE_NC},
-                     {\tt FILETYPE_NC2}, {\tt FILETYPE_SRV}, and {\tt FILETYPE_EXT}.
+                     {\tt FILETYPE_NC2}, {\tt FILETYPE_SRV}, {\tt FILETYPE_EXT} and {\tt FILETYPE_IEG}.
 
 @Description
 The function {\tt streamOpenWrite} creates a new datset.
@@ -984,7 +984,7 @@ void streamClose(int streamID)
 
 /*
 @Function  streamDefTimestep
-@Title     Define timestep
+@Title     Define time step
 
 @Prototype int streamDefTimestep(int streamID, int tsID)
 @Parameter
@@ -992,10 +992,10 @@ void streamClose(int streamID)
     @Item  tsID      Timestep identifier
 
 @Description
-The function {\tt streamDefTimestep} defines the timestep of a stream.
+The function {\tt streamDefTimestep} defines the time step of a stream.
 
 @Result
-{\tt streamDefTimestep} returns the number of records of the timestep.
+{\tt streamDefTimestep} returns the number of records of the time step.
 
 @EndFunction
 */
@@ -1046,7 +1046,7 @@ int streamDefTimestep(int streamID, int tsID)
 
 /*
 @Function  streamInqTimestep
-@Title     Get timestep
+@Title     Get time step
 
 @Prototype int streamInqTimestep(int streamID, int tsID)
 @Parameter
@@ -1054,10 +1054,10 @@ int streamDefTimestep(int streamID, int tsID)
     @Item  tsID      Timestep identifier
 
 @Description
-The function {\tt streamInqTimestep} returns the timestep of a stream.
+The function {\tt streamInqTimestep} returns the time step of a stream.
 
 @Result
-{\tt streamInqTimestep} returns the number of records of the timestep.
+{\tt streamInqTimestep} returns the number of records of the time step.
 
 @EndFunction
 */
@@ -1157,11 +1157,14 @@ int streamInqTimestep(int streamID, int tsID)
 
 @Prototype void streamReadVar(int streamID, int varID, double *data, int *nmiss)
 @Parameter
-    @Item  streamID  Stream identifier
+    @Item  streamID  Stream identifier, from a previous call to streamOpenRead
     @Item  varID     Variable identifier
-    @Item  data      Data
+    @Item  data      Pointer to the location into which the data value is read
     @Item  nmiss     Number of missing values
 
+@Description
+The function streamReadVar reads all the values of one time step of a variable
+from an open dataset.
 @EndFunction
 */
 void streamReadVar(int streamID, int varID, double *data, int *nmiss)
@@ -1231,11 +1234,14 @@ void streamReadVar(int streamID, int varID, double *data, int *nmiss)
 
 @Prototype void streamWriteVar(int streamID, int varID, double *data, int nmiss)
 @Parameter
-    @Item  streamID  Stream identifier
+    @Item  streamID  Stream identifier, from a previous call to streamOpenWrite
     @Item  varID     Variable identifier
-    @Item  data      Data
+    @Item  data      Pointer to a block of data values to be written
     @Item  nmiss     Number of missing values
 
+@Description
+The function streamWriteVar writes the values of one time step of a variable 
+to an open dataset.
 @EndFunction
 */
 void streamWriteVar(int streamID, int varID, double *data, int nmiss)
@@ -1306,12 +1312,15 @@ void streamWriteVar(int streamID, int varID, double *data, int nmiss)
 
 @Prototype void streamReadVarSlice(int streamID, int varID, int levelID, double *data, int *nmiss)
 @Parameter
-    @Item  streamID  Stream identifier
+    @Item  streamID  Stream identifier, from a previous call to streamOpenRead
     @Item  varID     Variable identifier
     @Item  levelID   Level identifier
-    @Item  data      Data
+    @Item  data      Pointer to the location into which the data value is read
     @Item  nmiss     Number of missing values
 
+@Description
+The function streamReadVar reads all the values of a horizontal slice of a variable
+from an open dataset.
 @EndFunction
 */
 void streamReadVarSlice(int streamID, int varID, int levelID, double *data, int *nmiss)
@@ -1379,12 +1388,15 @@ void streamReadVarSlice(int streamID, int varID, int levelID, double *data, int
 
 @Prototype void streamWriteVarSlice(int streamID, int varID, int levelID, double *data, int nmiss)
 @Parameter
-    @Item  streamID  Stream identifier
+    @Item  streamID  Stream identifier, from a previous call to streamOpenWrite
     @Item  varID     Variable identifier
     @Item  levelID   Level identifier
-    @Item  data      Data
+    @Item  data      Pointer to a block of data values to be written
     @Item  nmiss     Number of missing values
 
+@Description
+The function streamWriteVarSlice writes the values of a horizontal slice of a 
+variable to an open dataset.
 @EndFunction
 */
 void streamWriteVarSlice(int streamID, int varID, int levelID, double *data, int nmiss)
diff --git a/src/taxis.c b/src/taxis.c
index 91e4029bb..f9f216f64 100644
--- a/src/taxis.c
+++ b/src/taxis.c
@@ -179,7 +179,7 @@ static void taxisCheckID(const char *func, int taxisID)
 
 /*
 @Function  taxisCreate
-@Title     Create a new T-axis
+@Title     Create a Time axis
 
 @Prototype int taxisCreate(int taxistype)
 @Parameter
@@ -187,10 +187,10 @@ static void taxisCheckID(const char *func, int taxisID)
                       The valid CDI time types are {\tt TAXIS_ABSOLUTE} and {\tt TAXIS_RELATIVE}.
 
 @Description
-The function {\tt taxisCreate} creates a new Time axis.
+The function {\tt taxisCreate} creates a Time axis.
 
 @Result
-{\tt taxisCreate} returns an identifier to the new T-axis.
+{\tt taxisCreate} returns an identifier to the Time axis.
 
 @EndFunction
 */
@@ -212,6 +212,21 @@ int taxisCreate(int taxistype)
 }
 
 
+/*
+@Function  taxisDestroy
+@Title     Destroy a Time axis
+
+@Prototype void taxisDestroy(int taxisID)
+@Parameter
+    @Item  taxisID Identifier, from a previous call to {\tt taxisCreate}
+
+@EndFunction
+*/
+void taxisDestroy(int taxisID)
+{
+}
+
+
 int taxisDuplicate(int taxisID1)
 {
   static char func[] = "taxisDuplicate";
diff --git a/src/vlist.c b/src/vlist.c
index d0b820fb3..c94f4a767 100644
--- a/src/vlist.c
+++ b/src/vlist.c
@@ -260,7 +260,7 @@ int vlistCreate(void)
 
 /*
 @Function  vlistDestroy
-@Title     Delete a variable list
+@Title     Destroy a variable list
 
 @Prototype void vlistDestroy(int vlistID)
 @Parameter
diff --git a/src/zaxis.c b/src/zaxis.c
index bbeac3d5b..4a707569c 100644
--- a/src/zaxis.c
+++ b/src/zaxis.c
@@ -148,7 +148,7 @@ void zaxisCheckID(const char *func, int zaxisID)
 
 /*
 @Function  zaxisCreate
-@Title     Create a new Z-axis
+@Title     Create a vertical Z-axis
 
 @Prototype int zaxisCreate(int zaxistype, int size)
 @Parameter
@@ -159,10 +159,10 @@ void zaxisCheckID(const char *func, int zaxisID)
     @Item  size       Number of levels
 
 @Description
-The function {\tt zaxisCreate} creates a new Z-axis.
+The function {\tt zaxisCreate} creates a vertical Z-axis.
 
 @Result
-{\tt zaxisCreate} returns an identifier to the new Z-axis.
+{\tt zaxisCreate} returns an identifier to the vertical Z-axis.
 
 @EndFunction
 */
@@ -199,6 +199,21 @@ int zaxisCreate(int zaxistype, int size)
 }
 
 
+/*
+@Function  zaxisDestroy
+@Title     Destroy a vertical Z-axis
+
+@Prototype void zaxisDestroy(int zaxisID)
+@Parameter
+    @Item  zaxisID Identifier, from a previous call to {\tt zaxisCreate}
+
+@EndFunction
+*/
+void zaxisDestroy(int zaxisID)
+{
+}
+
+
 char *zaxisNamePtr(int leveltype)
 {
   char *name;
-- 
GitLab