2.14 NF_CLOSE
The function NF_CLOSE closes an open netCDF dataset. If the dataset is
in define mode, NF_ENDDEF will be called before closing. (In this
case, if NF_ENDDEF returns an error, NF_ABORT will automatically be
called to restore the dataset to the consistent state before define
mode was last entered.) After an open netCDF dataset is closed, its
netCDF ID may be reassigned to the next netCDF dataset that is opened
or created.
Usage
INTEGER FUNCTION NF_CLOSE(INTEGER NCID)
NCID- NetCDF ID, from a previous call to NF_OPEN or NF_CREATE.
Errors
NF_CLOSE returns the value NF_NOERR if no errors occurred. Otherwise,
the returned status indicates an error. Possible causes of errors
include:
- Define mode was entered and the automatic call made to NF_ENDDEF
failed.
- The specified netCDF ID does not refer to an open netCDF dataset.
Example
Here is an example using NF_CLOSE to finish the definitions of a new
netCDF dataset named foo.nc and release its netCDF ID:
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_CLOSE(NCID)
IF (STATUS .NE. NF_NOERR) CALL HANDLE_ERR(STATUS)