Next: , Previous: NF_REDEF, Up: Datasets


2.10 NF_ENDDEF

The function NF_ENDDEF takes an open netCDF dataset out of define mode. The changes made to the netCDF dataset while it was in define mode are checked and committed to disk if no problems occurred. Non-record variables may be initialized to a "fill value" as well (see NF_SET_FILL). The netCDF dataset is then placed in data mode, so variable data can be read or written.

This call may involve copying data under some circumstances. See File Structure and Performance.

Usage

     INTEGER FUNCTION NF_ENDDEF(INTEGER NCID)
NCID
NetCDF ID, from a previous call to NF_OPEN or NF_CREATE.

Errors

NF_ENDDEF returns the value NF_NOERR if no errors occurred. Otherwise, the returned status indicates an error. Possible causes of errors include:

Example

Here is an example using NF_ENDDEF to finish the definitions of a new netCDF dataset named foo.nc and put it into data mode:

     INCLUDE 'netcdf.inc'
        ...
     INTEGER NCID, STATUS
        ...
     STATUS = NF_CREATE('foo.nc', NF_NOCLOBBER, NCID)
     IF (STATUS .NE. NF_NOERR) CALL HANDLE_ERR(STATUS)
     
        ...   ! create dimensions, variables, attributes
     
     STATUS = NF_ENDDEF(NCID)
     IF (STATUS .NE. NF_NOERR) CALL HANDLE_ERR(STATUS)