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: Format, Up: Introduction



1.4 How to Select the Format

The format of a netCDF file is determined at create time. The default is classic format. The 64-bit offset format will only be used if the mode parameter to the create function includes the flag for 64-bit offset format.

When opening an existing netCDF file the netCDF library will transparently detect its format and adjust accordingly. However, netCDF library versions earlier than 3.6.0 cannot read 64-bit offset format files. NetCDF classic format files (even if created by version 3.6.0 or later) remain compatible with older versions of the netCDF library.

Users are encouraged to use netCDF classic format to distribute data, for maximum portability.

To select 64-bit offset format files, C programmers should use flag NC_64BIT_OFFSET in function nc_create. See nc_create (The NetCDF C Interface Guide).

In Fortran 77, use flag nf_64bit_offset in function NF_CREATE. See NF_CREATE (The NetCDF Fortran 77 Interface Guide).)

In Fortran 90, use flag NF90_64BIT_OFFSET in function NF90_CREATE. See NF90_CREATE (The NetCDF Fortran 90 Interface Guide).)

It is also possible to change the default creation format, to convert a large body of code without changing every create call. C programmers see nc_set_default_format (The NetCDF C Interface Guide). Fortran programs see NF_SET_DEFAULT_FORMAT (The NetCDF Fortran 77 Interface Guide).

1.4.1 NetCDF Classic Format

The original netCDF format is identified using four bytes in the file header. All files in this format have “CDF\001” at the beginning of the file. In this documentation this format is referred to as “netCDF classic format.”

NetCDF classic format is identical to the format used by every previous version of netCDF. It has maximum portability, and is still the default netCDF format.

1.4.2 NetCDF 64-bit Offset Format

Files with the 64-bit offsets are identified with a “CDF\002” at the beginning of the file. In this documentation this format is called “64-bit offset format.”

For some users, the various 2 GiB format limitations of the classic format become a problem. (see NetCDF Classic Format Limitations). For these users, 64-bit offset format is a natural choice. It greatly eases the size restrictions of netCDF classic files.

Since 64-bit offset format was introduced in version 3.6.0, earlier versions of the netCDF library can't read 64-bit offset files.

Create files in 64-bit offset-4 format by specifying the 64 bit offset flag when creating a file.
 
 
  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