NSF Unidata

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDF #XQJ-446811]: netcdf 4.0 record size question

This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.



Hi David,

When you say you are "using netCDF 4.0", does that mean it was built
with the "--enable-netcdf-4" option to the configure script, that
requires installation of the HDF5 library as well?  You could tell
by looking at the installed netcdf.h header file (by default
/usr/local/include/netcdf.h, but may have been installed somewhere
else) for the string "nc_def_grp", a function defined for netCDF-4.

If you built and installed the libraries just using default
settings, without explicitly specifying --enable-netcdf-4, then
it will really be netCDF-3.6.3, and netcdf.h will not include the
string "nc_def_grp".  In that case, the only way a netCDF-3 variable
can exceed 4 GiB is if it is the last fixed-size variable or if it
uses the unlimited dimension, as explained here:

  http://www.unidata.ucar.edu/netcdf/docs/faq.html#Large%20File%20Support10

If you really have netCDF-4.0 with netCDF-4 features enabled, a file
must be created to support netCDF-4 features using the appropriate
creation flag, such as NC_NETCDF4 in the C statement:

  ret = nc_create(FILE_NAME, NC_NETCDF4, &ncid);

or NF90_HDF5 in the Fortran statement:

  ret = nf90_create(FILE_NAME, NF90_HDF5, ncid)

In such a file, non-record variables that are not the last variable in the file
are not limited to 4 GiB.

You can tell what kind of netCDF file you have with the "-k" flag to ncdump
in versions 3.6.2 and later.  If the result is "classic" or "64-bit offset",
it is not a netCDF-4 file.

--Russ




Russ Rew                                         UCAR Unidata Program
address@hidden                     http://www.unidata.ucar.edu



Ticket Details
===================
Ticket ID: XQJ-446811
Department: Support netCDF
Priority: Normal
Status: Closed