Previous: Whats Missing, Up: C interface changes from NetCDF 2 to NetCDF 3
There are two new functions in netCDF-3 that don't correspond to any netCDF-2 functions: NF_INQ_LIBVERS and NF_STRERROR. The version of the netCDF library in use is returned as a string by NF_INQ_LIBVERS. An error message corresponding to the status returned by a netCDF function call is returned as a string by the NF_STRERROR function.
A new NF_SHARE flag is available for use in an NF_OPEN or NF_CREATE CALL, to suppress the default buffering of accesses. The use of NF_SHARE for concurrent access to a netCDF dataset means you don't have to call NF_SYNC after every access to make sure that disk updates are synchronous. It is important to note that changes to ancillary data, such as attribute values, are not propagated automatically by use of the NF_SHARE flag. Use of the NF_SYNC function is still required for this purpose.
The version 2 interface had a single inquiry function, ncvarinq for getting the name, type, and shape of a variable. Similarly, only a single inquiry function was available for getting information about a dimension, an attribute, or a netCDF dataset. When you only wanted a subset of this information, you had to provide NULL arguments as placeholders for the unneeded information. The new interface includes additional inquire functions that return each item separately, so errors are less likely from miscounting arguments.
The previous implementation returned an error when 0-valued count components were specified in ncvarput and ncvarget calls. This restriction has been removed, so that now functions in the NF_PUT_VAR AND NF_GET_VAR families may be called with 0-valued count components, resulting in no data being accessed. Although this may seem useless, it simplifies some programs to not treat 0-valued counts as a special case.
The previous implementation returned an error when the same dimension was used more than once in specifying the shape of a variable in ncvardef. This restriction is relaxed in the netCDF-3 implementation, because an autocorrelation matrix is a good example where using the same dimension twice makes sense.
In the new interface, units for the imap argument to the NF_PUT_VARM AND NF_GET_VARM families of functions are now in terms of the number of data elements of the desired internal type, not in terms of bytes as in the netCDF version-2 mapped access interfaces.
Following is a table of netCDF-2 function names and names of the corresponding netCDF-3 functions. For parameter lists of netCDF-2 functions, see the netCDF-2 User's Guide.
ncabort
ncattcopy
ncattdel
ncattget
ncattinq
ncattname
ncattput
ncattrename
ncclose
nccreate
ncdimdef
ncdimid
ncdiminq
ncdimrename
ncendef
ncinquire
ncopen
ncrecget
ncrecinq
ncrecput
ncredef
ncsetfill
ncsync
nctypelen
ncvardef
ncvarget
ncvarget1
ncvargetg
ncvarid
ncvarinq
ncvarput
ncvarput1
ncvarputg
ncvarrename
(none)
(none)