1

I have file of NetCDF version 3. I used the latest ncks for Windows (released 1 Oct 2014) to rechunk my file ncks -4 --cnk_dmn lat,4 --cnk_dmn lon,4 --cnk_dmn time,512 2014.nc 2014_chunked.nc what produced 2014_chunked.nc file of NetCDF version 4

The new file 2014_chunked.nc can be read by WCT, for example. However, java code yields

 [ucar.nc2.NetcdfFile] DEBUG Using IOSP ucar.nc2.iosp.hdf5.H5iosp
 [ucar.nc2.iosp.hdf5.H5header] ERROR bad version 72 at filePos 22386

and throws exception

The code is

import ucar.nc2.NetcdfFile;
NetcdfFile nativeNetCDFFile = NetcdfFile.open(fullPath);

I use the latest NetCDF4.5 for JRE 7 http://www.unidata.ucar.edu/downloads/netcdf/netcdf-java-4/index.jsp

I looked at netcdf jar file and discovered that Nc4.class is only several bytes in length, thus the jar does not have NetCDF4 iosp and uses H5iosp for NetCDF 4 files.

I suppose that new version of NetCDF 4.5 java must be used slightly different from the version 4.2 I used all the time since the same java code for opening HDF5 and HDF4 files for netcdf 4.2 works fine but for 4.5 does not:

private NetcdfFile file;
....
String path = groupInFile + GROUP_DELIMITER + nameInGroup;
Variable findVariable = file.findVariable(path);

What is wrong?

trivelt
  • 1,913
  • 3
  • 22
  • 44
Antonio
  • 756
  • 7
  • 26

1 Answers1

0

That was a bug in NetCDF that was fixed since version 4.5.4 due to my bug report to NetCDF team: http://www.unidata.ucar.edu/mailing_lists/archives/netcdf-java/2015/msg00028.html

Antonio
  • 756
  • 7
  • 26