Previous: NF_SET_FILL, Up: Datasets


2.17 NF_SET_DEFAULT_FORMAT

This function is intended for advanced users.

Starting in version 3.6, netCDF introduced a new data format, the first change in the underlying binary data format since the netCDF interface was released. The new format, 64-bit offset format, was introduced to greatly relax the limitations on creating very large files.

Users are warned that creating files in the 64-bit offset format makes them unreadable by the netCDF library prior to version 3.6.0. For reasons of compatibility, users should continue to create files in netCDF classic format.

Users who do want to use 64-bit offset format files can create them directory from NF_CREATE, using the proper cmode flag. (see NF_CREATE).

The function NF_SET_DEFAULT_FORMAT allows the user to change the format of the netCDF file to be created by future calls to NF_CREATE without changing the cmode flag.

This allows the user to convert a program to use 64-bit offset formation without changing all calls the NF_CREATE. See Large File Support.

Once the default format is set, all future created files will be in the desired format.

Two constants are provided in the netcdf.inc file to be used with this function, nf_format_64bit and nf_format_classic.

Using NF_CREATE with a cmode including nf_64bit_offset overrides the default format, and creates a 64-bit offset file.

Usage

     INTEGER FUNCTION NF_SET_DEFAULT_FORMAT(INTEGER FORMAT, INTEGER OLD_FORMT)
FORMAT
Either nf_format_64bit or nf_format_classic.
OLD_FORMAT
The default format at the time the function is called is returned here.

Errors

NF_SET_FILL 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_SET_FILL to set nofill mode for subsequent writes of a netCDF dataset named foo.nc:

     INCLUDE 'netcdf.inc'
        ...
     INTEGER STATUS, OLD_FORMAT
        ...
     STATUS = NF_SET_DEFAULT_FORMAT(nf_format_64bit, OLD_FORMAT)
     IF (STATUS .NE. NF_NOERR) CALL HANDLE_ERR(STATUS)
        ...