Re: [netcdfgroup] The netCDF format flavor generated by ncgen

Hi,

Many thanks to Russ and David Pierce for the tips.

With ncgen I generated a netcdf-4 classic and
a netcdf-4 file by using the command line options
-k "netCDF-4 classic model" and -k "netCDF-4",
respectively.

The nc files generated this way have the expected format:

  $ ncdump -k sample4.nc
  netCDF-4

  $ ncdump -k sample4-classic.nc
  netCDF-4 classic model

and differ in length by 13 bytes:

    $ ls -l sample4*nc
   -rw-r--r-- 1 gabriel users 15695 Dec 21 17:29 sample4-classic.nc
   -rw-r--r-- 1 gabriel users 15708 Dec 21 16:44 sample4.nc

which is exactly the length of the string "classic model".  So I
checked if the difference in the files comes only from meta-data

$ od -c sample4.nc | more 0000000 211 H D F \r \n 032 \n 002 \b \b \0 \0 \0 \0 \0
  0000020  \0  \0  \0  \0 377 377 377 377 377 377 377 377   \   =  \0  \0
  0000040  \0  \0  \0  \0   0  \0  \0  \0  \0  \0  \0  \0 332 323   H   *
  ...

$ od -c sample4-classic.nc | more 0000000 211 H D F \r \n 032 \n 002 \b \b \0 \0 \0 \0 \0
  0000020  \0  \0  \0  \0 377 377 377 377 377 377 377 377   O   =  \0  \0
  0000040  \0  \0  \0  \0   0  \0  \0  \0  \0  \0  \0  \0   I 263   j   }
  ...

The dump seems to indicate that the data in netCDF-4 is
different from that in neCDF-4 classic, even though I have
not used any "new" API features (these files are obtained from
a cdl file with ncgen). Or am I interpreting incorrectly the output
from "od" ?

Thank you.
Gabriel


Russ Rew wrote:
Hi Gabriel,

I have installed netCDF-4.0.1 and I generated
a .nc file using ncgen.

I would like to ask what is the flavor of the
format generated by ncgen: is it the so-called
netcdf4-classic or the new new hdf5-based
format?

How can I check the which flavor is generated
by ncgen?

You can use the "-k" option of ncdump to determine what kind of netCDF
file you have.  For example:

      $ ncdump -k foo.nc
      classic

Similarly, you can use the "-k" option of ncgen to specify which kind of
netCDF file to generate (or to generate code for).

--Russ

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