Commit 8030d77a authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

add dummy functions gridDestroy, zaxisDestroy, taxisDestroy

parent a53177c7
......@@ -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
......
......@@ -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>
......
## Process this file with automake to produce Makefile.in
#
SUBDIRS = src prog tests
SUBDIRS = src prog examples tests
#
EXTRA_DIST=config/default
#
......
......@@ -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
#
......
......@@ -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
......
......@@ -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)
......@@ -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
......
......@@ -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
......
\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}
\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.
......
\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
......@@ -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}