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.
>From: William Collins <address@hidden> >Subject: HDF to NetCDF conversion? >Organization: NCAR/CGD >Keywords: 199803201536.IAA15971 netCDF HDF Hi Bill, > Sorry, but searches of the resources listed in the > Scientific Data Format Information FAQ webpage came up empty... > > > Are you aware of tools to convert HDF to NetCDF? I know > that HDF has tools for reading NetCDF, but I'd like to > go the other way, since I'm conversant in NetCDF but do > know HDF at all. Could NCL do the trick? It might not be possible to convert *general* HDF data to netCDF data in any straightforward way, because the data models are not the same. For example, if the HDF data made heavy use of vdata and vgroup APIs to represent hierarchical data structures such as trees, the netCDF representation in terms of multidimensional variables would require some extra conventions. However, I believe it is possible to use NCL to read in HDF data and then write it out in netCDF form, as long as it conforms to the netCDF data model. Another possibility is DDI, a package from LLNL that's freely available and described at http://www-pcmdi.llnl.gov/software/ddi/ It claims to be able to read and write HDF and netCDF, but we haven't ever installed it here to try it. Also, the HDF 4.x (I think the latest is 4.1 release 2) library does contain support for reading data with the netCDF-2 interfaces from netCDF files in the Unidata file format and for reading and writing through the netCDF-2 interfaces in the HDF format. So it might be practical to create a program that reads an HDF file using an HDF interface and writes the data in an HDF-encoded netCDF file using the netCDF-2 interfaces in HDF. The resulting file would be an HDF file, but one you could still access data from using netCDF-2 interfaces. Now that I read it, that sounds pretty complicated ... Anyway, good luck, and please let us know what the easiest thing you find is ... --Russ _____________________________________________________________________ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu