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.
> 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