Next: NF_INQ Family, Previous: NF__ENDDEF, Up: Datasets
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.
INTEGER FUNCTION NF_CLOSE(INTEGER NCID)
NCID
NF_CLOSE returns the value NF_NOERR if no errors occurred. Otherwise, the returned status indicates an error. Possible causes of errors include:
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)