Go to the previous, next section.
The function ncdimdef
(or NCDDEF
for FORTRAN) adds a new
dimension to an open netCDF file in define mode. It returns a dimension
ID, given the netCDF ID, the dimension name, and the dimension size. At
most one unlimited size dimension, called the record dimension,
may be defined for each netCDF file.
In case of an error, ncdimdef
returns -1; NCDDEF
returns a
nonzero value in rcode
. Possible causes of errors include:
int ncdimdef(int ncid, const char* name, long size);
ncid
ncopen
or nccreate
.
name
size
long
) or the predefined constant NC_UNLIMITED
.
Here is an example using ncdimdef
to create a dimension named
lat
of size 18 and a record dimension named rec
in a new
netCDF file named `foo.nc':
#include "netcdf.h" ... int ncid, latid, recid; ... ncid = nccreate("foo.nc", NC_NOCLOBBER); ... latid = ncdimdef(ncid, "lat", 18L); recid = ncdimdef(ncid, "rec", NC_UNLIMITED);
INTEGER FUNCTION NCDDEF (INTEGER NCID, + CHARACTER*(*) DIMNAM, + INTEGER DIMSIZ, + INTEGER RCODE)
NCID
NCOPN
or NCCRE
.
DIMNAM
DIMSIZ
NCUNLIM
.
RCODE
Here is an example using NCDDEF
to create a dimension named
lat
of size 18 and a record dimension named rec
in a new
netCDF file named `foo.nc':
INCLUDE 'netcdf.inc' ... INTEGER NCID, RCODE, LATID, RECID ... NCID = NCCRE('foo.nc', NCNOCLOB, RCODE) ... LATID = NCDDEF(NCID, 'lat', 18, RCODE) RECID = NCDDEF(NCID, 'rec', NCUNLIM, RCODE)
Go to the previous, next section.