Go to the previous, next section.
The function ncendef (or NCENDF for FORTRAN) takes an open
netCDF file out of define mode. The changes made to the netCDF file
while it was in define mode are checked and committed to disk if no
problems occurred. The netCDF file is then placed in data mode, so
variable data can be read or written.
This call can be expensive, since it involves initializing non-record variables and copying data under some circumstances. See section NetCDF File Structure and Performance, for a more extensive discussion.
In case of an error, ncendef returns -1; NCENDF returns a
nonzero value in rcode. Possible causes of errors include:
int ncendef(int ncid);
ncid
ncopen or nccreate.
ncendef to finish the definitions of a
new netCDF file named `foo.nc' and put it into data mode:
#include "netcdf.h"
...
int ncid;
...
ncid = nccreate("foo.nc", NC_NOCLOBBER);
... /* create dimensions, variables, attributes */
ncendef(ncid); /*leave define mode*/
SUBROUTINE NCENDF(INTEGER NCID, INTEGER RCODE)
NCID
NCOPN or NCCRE.
RCODE
Here is an example using NCENDF to finish the definitions of a
new netCDF file named `foo.nc' and put it into data mode:
INCLUDE 'netcdf.inc'
...
INTEGER NCID
...
NCID = NCCRE('foo.nc', NCNOCLOB, RCODE)
... ! create dimensions, variables, attributes
CALL NCENDF(NCID, RCODE)
Go to the previous, next section.