NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.


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

Re: netCDF and HDF



> Organization: IBM
> Keywords: 199503080247.AA24598

Lloyd,

> Let me ask another question about converting between HDF-encoded netCDFs
> and XDR netCDFs.  If I recall ncdump produces to stdout what would be
> suitable for input to ncgen.  Could I then pipe the output from the mfhdf
> ncdump to the Unidata ncgen and get an XDR-encoded netCDF that our current
> code would read?  Granted this operation would not be efficient, given
> conversion to ASCII and scribbling over a pipe.  But would it be a crude
> workaround for these folks that I working with?

Yes, that's a clever way to convert an HDF-encoded netCDF file to an
XDR-encoded netCDF file.  The invocation would be:

   HDFncdump file.hdf | ncgen -o file.nc -

where "file.hdf" is the input HDF-encoded netCDF file, and "file.nc" is the
output equivalent netCDF file.

It's a little slow, but it seems to work fine, except that the default
precision that ncdump uses to output floating-point and double-precision
values (6 and 15 significant digits) may lose some precision in the output
file.  There are ncdump flags that permit specifying the precision used.

--Russ