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.
Hi John, now it's clear, thank you! Enrico On 11/10/2012 12:51 AM, John Caron wrote:
Hi Enrico:The problem is that the hdf4 file has groups, and FileWriter.writeToFile() writes netcdf3 files, which does not.4.3.14 will have the ability to write to netcdf4 files. John On 11/5/2012 10:03 AM, Enrico Boldrini wrote:Dear John, I'm a colleague of Stefano Nativi (CNR, Italy). I'm using your very helpful Java library for NetCDF; I've found a potential problem trying to convert a hdf file to a NetCDF file, with the following code: NetcdfFile ncFile = NetcdfFile.open("/home/boldrini/Downloads/MOD17A3.C5.1.GEO.2000.hdf"); File outFile = File.createTempFile("HDF", ".nc"); ucar.nc2.FileWriter.writeToFile(ncFile, outFile.getAbsolutePath()); (The input file can be downloaded at:ftp://nacp.ornl.gov/synthesis/2008/firenze/continental/ARCHIVAL/original/OM_MODIS_GPP/MOD17A3.C5.1.GEO.2000.hdf)The stack trace I get is the following: Exception in thread "main" java.lang.IllegalArgumentException: illegal netCDF-3 object name at ucar.nc2.NetcdfFileWriteable.addDimension(NetcdfFileWriteable.java:234) at ucar.nc2.FileWriter.writeToFile(FileWriter.java:135) at ucar.nc2.FileWriter.writeToFile(FileWriter.java:82)at eu.floraresearch.sdi.gt_coverage.gt.HDFTest.main(HDFTest.java:11)(it seems related to escaped names.. just guessing) Am I missing/misusing something? Any feedback is appreciated, thank you! Enrico Boldrini