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



2.9 NF90_CLOSE

The function NF90_CLOSE closes an open netCDF dataset. If the dataset is in define mode, NF90_ENDDEF will be called before closing. (In this case, if NF90_ENDDEF returns an error, NF90_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

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

Errors

NF90_CLOSE 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_CLOSE to finish the definitions of a new netCDF dataset named foo.nc and release its netCDF ID:

      use netcdf
      implicit none
      integer :: ncid, status
      ...
      status = nf90_create("foo.nc", nf90_noclobber, ncid)
      if (status /= nf90_noerr) call handle_err(status)
      ...  !  create dimensions, variables, attributes
      status = nf90_close(ncid)
      if (status /= nf90_noerr) call handle_err(status)
 
 
  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