Next: , Previous: NF__CREATE, Up: Datasets


2.7 NF_OPEN

The function NF_OPEN opens an existing netCDF dataset for access.

Usage

     INTEGER FUNCTION NF_OPEN(CHARACTER*(*) PATH, INTEGER OMODE, INTEGER ncid)
PATH
File name for netCDF dataset to be opened.
OMODE
A zero value (or NF_NOWRITE) specifies the default behavior: open the dataset with read-only access, buffering and caching accesses for efficiency.

Otherwise, the creation mode is NF_WRITE, NF_SHARE, or OR(NF_WRITE, NF_SHARE). Setting the NF_WRITE flag opens the dataset with read-write access. ("Writing" means any kind of change to the dataset, including appending or changing data, adding or renaming dimensions, variables, and attributes, or deleting attributes.) The NF_SHARE flag is appropriate when one process may be writing the dataset and one or more other processes reading the dataset concurrently; it means that dataset accesses are not buffered and caching is limited. Since the buffering scheme is optimized for sequential access, programs that do not access data sequentially may see some performance improvement by setting the NF_SHARE flag.

ncid
Returned netCDF ID.

Errors

NF_OPEN 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_OPEN to open an existing netCDF dataset named foo.nc for read-only, non-shared access:

     INCLUDE 'netcdf.inc'
      ...
     INTEGER NCID, STATUS
     ...
     STATUS = NF_OPEN('foo.nc', 0, NCID)
     IF (STATUS .NE. NF_NOERR) CALL HANDLE_ERR(STATUS)