Re: [netcdfgroup] need to id netcdf files

Jim,

> I am in need of a function that can identify a file as netcdf3, netcdf4, or
> pnetcdf 64-bit.
> Preferably I would like this function to work without having linked any of
> the mentioned netcdf libraries.
> 
> Does anyone have or know of one?

Although it doesn't match your preference for independence from netCDF
libraries, the nc_inq_format() function documented here:

  
http://www.unidata.ucar.edu/software/netcdf/docs/netcdf-c.html#nc_005finq-Family

distinguishes among the 4 netCDF format variants:

  http://www.unidata.ucar.edu/software/netcdf/docs/faq.html#fv1

in the netCDF-4 library or between classic and 64-bit-offset formats in
a netCDF-3 library.  It doesn't recognize the pnetcdf 64-bit variant.

By the way, an HDF5 file can't necessarily be distinguished by its first
4 bytes, because HDF5 files may begin with a "user-block" of size 512,
1024, 2048, ... bytes, before the 4-byte file-type signature.

--Russ



  • 2010 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: