Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

Next: , Previous: NF_SYNC, Up: Datasets



2.17 NF_ABORT

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.

Usage

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

Errors

NF_ABORT 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_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
     ...
 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Office of Programs University Corporation for Atmospheric Research (UCAR)   Unidata is a member of the UCAR Office of Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690