You no longer need to call this function, since it is called automatically by NF_CLOSE in case the dataset is in define mode and something goes wrong with committing the changes. The function NF_ABORT just closes the netCDF dataset, if not in define mode. If the dataset is being created and is still in define mode, the dataset is deleted. If define mode was entered by a call to NF_REDEF, the netCDF dataset is restored to its state before definition mode was entered and the dataset is closed.
INTEGER FUNCTION NF_ABORT(INTEGER NCID)
NCID
NF_ABORT 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_ABORT to back out of redefinitions of a dataset named foo.nc:
INCLUDE 'netcdf.inc' ... INTEGER STATUS, NCID, LATID ... STATUS = NF_OPEN('foo.nc', NF_WRITE, NCID) IF (STATUS .NE. NF_NOERR) CALL HANDLE_ERR(STATUS) ... STATUS = NF_REDEF(NCID) IF (STATUS .NE. NF_NOERR) CALL HANDLE_ERR(STATUS) ... STATUS = NF_DEF_DIM(NCID, 'LAT', 18, LATID) IF (STATUS .NE. NF_NOERR) THEN ! dimension definition failed CALL HANDLE_ERR(STATUS) STATUS = NF_ABORT(NCID) ! abort redefinitions IF (STATUS .NE. NF_NOERR) CALL HANDLE_ERR(STATUS) ENDIF ...