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: NF90_SYNC, Up: Datasets



2.12 NF90_ABORT

You no longer need to call this function, since it is called automatically by NF90_CLOSE in case the dataset is in define mode and something goes wrong with committing the changes. The function NF90_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 NF90_REDEF, the netCDF dataset is restored to its state before definition mode was entered and the dataset is closed.

Usage

      function nf90_abort(ncid)
        integer, intent( in) :: ncid
        integer              :: nf90_abort
ncid
NetCDF ID, from a previous call to NF90_OPEN or NF90_CREATE.

Errors

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

Example

Here is an example using NF90_ABORT to back out of redefinitions of a dataset named foo.nc:

      use netcdf
      implicit none
      integer :: ncid, status, LatDimID
      ...
      status = nf90_open("foo.nc", nf90_write, ncid)
      if (status /= nf90_noerr) call handle_err(status)
      ...
      status = nf90_redef(ncid)
      if (status /= nf90_noerr) call handle_err(status)
      ...
      status = nf90_def_dim(ncid, "Lat", 18, LatDimID)
      if (status /= nf90_noerr) then ! Dimension definition failed
        call handle_err(status)
        status = nf90_abort(ncid) ! Abort redefinitions
        if (status /= nf90_noerr) call handle_err(status)
      end if
     ...
 
 
  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