Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
8030d77a
Commit
8030d77a
authored
May 12, 2006
by
Uwe Schulzweida
Browse files
add dummy functions gridDestroy, zaxisDestroy, taxisDestroy
parent
a53177c7
Changes
40
Hide whitespace changes
Inline
Side-by-side
.gitattributes
View file @
8030d77a
...
...
@@ -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
...
...
ChangeLog
View file @
8030d77a
...
...
@@ -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>
...
...
Makefile.am
View file @
8030d77a
## Process this file with automake to produce Makefile.in
#
SUBDIRS
=
src prog tests
SUBDIRS
=
src prog
examples
tests
#
EXTRA_DIST
=
config/default
#
...
...
Makefile.in
View file @
8030d77a
...
...
@@ -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
#
...
...
configure
View file @
8030d77a
...
...
@@ -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
...
...
configure.ac
View file @
8030d77a
...
...
@@ -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
)
doc/tex/FUNCTIONS
View file @
8030d77a
...
...
@@ -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
-------------------------------------------------------------
vlist
New
Create a variable list
vlist
Free
Delete
a variable list
vlist
Create
Create a variable list
vlist
Destroy
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
...
...
doc/tex/Modules
View file @
8030d77a
...
...
@@ -10,8 +10,8 @@ streamWriteVar stream
streamReadVar stream
streamWriteVarSlice stream
streamReadVarSlice stream
vlist
New
vlist
vlist
Free
vlist
vlist
Create
vlist
vlist
Destroy
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
...
...
doc/tex/c_examples.tex
0 → 100644
View file @
8030d77a
\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
}
doc/tex/c_grid.tex
View file @
8030d77a
\section
{
Create a
new
Grid:
{
\tt
grid
New
}}
\index
{
grid
New
}
\label
{
grid
New
}
\section
{
Create a
horizontal
Grid:
{
\tt
grid
Create
}}
\index
{
grid
Create
}
\label
{
grid
Create
}
The function
{
\tt
grid
New
}
creates a
new
Grid.
The function
{
\tt
grid
Create
}
creates a
horizontal
Grid.
\subsection*
{
Usage
}
\begin{verbatim}
int grid
New
(int gridtype, int size);
int grid
Create
(int gridtype, int size);
\end{verbatim}
\hspace*
{
4mm
}
\begin{minipage}
[]
{
15cm
}
...
...
@@ -26,12 +26,14 @@ Number of gridpoints.
\subsection*
{
Result
}
{
\tt
grid
New
}
returns an identifier to the
new
Grid.
{
\tt
grid
Create
}
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 = grid
New
(GRID
_
LONLAT, nlon*nlat);
gridID = grid
Create
(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
g
rid:
{
\tt
gridDuplicate
}}
\section
{
Duplicate a
horizontal G
rid:
{
\tt
gridDuplicate
}}
\index
{
gridDuplicate
}
\label
{
gridDuplicate
}
The function
{
\tt
gridDuplicate
}
duplicates a
g
rid.
The function
{
\tt
gridDuplicate
}
duplicates a
horizontal G
rid.
\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
grid
New
}
,
Identifier, from a previous call to
{
\tt
grid
Create
}
,
{
\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
g
rid.
{
\tt
gridDuplicate
}
returns an identifier to the duplicated
G
rid.
...
...
doc/tex/c_ref.tex
View file @
8030d77a
\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
g
rid
Duplicate a
horizontal G
rid
\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
{
vlistD
uplicate
}{
vlistDuplicate
}}
\section*
{
\tt
\htmlref
{
vlistD
estroy
}{
vlistDestroy
}}
\begin{verbatim}
int
vlistD
uplicate
(int vlistID);
void
vlistD
estroy
(int vlistID);
\end{verbatim}
D
uplicate
a variable list
D
estroy
a variable list
\section*
{
\tt
\htmlref
{
vlist
Free
}{
vlistFre
e
}}
\section*
{
\tt
\htmlref
{
vlist
Duplicate
}{
vlistDuplicat
e
}}
\begin{verbatim}
void
vlist
Fre
e(int vlistID);
int
vlist
Duplicat
e(int vlistID);
\end{verbatim}
D
ele
te a variable list
D
uplica
te 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
doc/tex/c_stream.tex
View file @
8030d77a
...
...
@@ -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