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

[netCDF #CTW-339617]: netcdf version check



Hi Wei,

> ... For example, can we check one of these
> in netcdf.inc to see what version the user's using?
>
> parameter (nf_format_64bit = 2)
> parameter (nf_format_netcdf4 = 3)
> parameter (nf_format_netcdf4_classic = 4)

If you want to check the format version of a netCDF file, you can do that
with the ncdump utility by using the "-k" option, as in

  $ ncdump -k foo.nc
  classic

The documentation for the "-k" option, available in the latest ncdump man
page, is as follows:

     -k   Show what kind of netCDF file the pathname  references,
          one  of  `classic',  `64-bit-offset',`hdf5',  or `hdf5-
          nc3'.  Before version 3.6, there was only one  kind  of
          netCDF file, designated as `classic' (also know as for-
          mat variant 1).  Large file support introduced  another
          variant  of  the  format, designated as `64-bit-offset'
          (known as format variant 2).  NetCDF-4,  uses  a  third
          variant  of  the  format,  `hdf5'  (format  variant 3).
          Another format variant, designated `hdf5-classic' (for-
          mat  variant 4), is restricted to features supported by
          the netCDF-3 data model but represented using the  HDF5
          format, so that an unmodified netCDF-3 program can read
          or write the file just by relinking with  the  netCDF-4
          library. ...

If you need to determine the file format variant from a program
rather than from the command line, you can use the library function
nc_inq_format (from C) or nf_inq_format (from Fortran 77 interface)
or nf90_inquire (from Fortran90 interface).

If instead of the file format version, you need the version of the
library software, you can use the library function nc_inq_libvers
(from C) or nf_inq_libvers (from Fortran 77 interface) or
nf90_inq_libvers (from Fortran 90 inteface).

If you want the version of the library software from the command line,
you can look at the last line of the output from "ncdump -version".

There is also a version number in the source distribution in the
file named "VERSION" at the top-level source directory, but there is
no easy way to find out the software package version from the
installed netcdf.inc or netcdf.h include files.  You would have to
know a mapping from the CVS file version number (such as "1.9" for netcdf.h)
to the package number (such as "4.0-beta2"), and we don't maintain
such a mapping.

I hope this helps ...

--Russ



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



Ticket Details
===================
Ticket ID: CTW-339617
Department: Support netCDF
Priority: Normal
Status: Closed