John,
A Panoply user has been having trouble opening a GRIB dataset due to an
exception thrown from somewhere inside the NJ library. The exception is caught
and re-thrown by NetcdfFile.open(), but further tracing reveals something going
on when Gri1IOSP tries to open the file.
java.io.IOException: java.lang.IllegalArgumentException: Attribute value cannot
be null
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:425)
at
ucar.nc2.dataset.NetcdfDataset.openOrAcquireFile(NetcdfDataset.java:699)
at ucar.nc2.dataset.NetcdfDataset.openDataset(NetcdfDataset.java:421)
at ucar.nc2.dataset.NetcdfDataset.acquireDataset(NetcdfDataset.java:516)
at ucar.nc2.dataset.NetcdfDataset.acquireDataset(NetcdfDataset.java:493)
at gov.nasa.giss.netcdf.NcDataset.init(NcDataset.java:118)
... more
Caused by: java.lang.IllegalArgumentException: Attribute value cannot be null
at ucar.nc2.Attribute.setStringValue(Attribute.java:508)
at ucar.nc2.Attribute.<init>(Attribute.java:370)
at ucar.nc2.grib.grib1.Grib1Iosp.addGroup(Grib1Iosp.java:338)
at ucar.nc2.grib.grib1.Grib1Iosp.open(Grib1Iosp.java:160)
at ucar.nc2.NetcdfFile.<init>(NetcdfFile.java:1521)
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:813)
at ucar.nc2.NetcdfFile.open(NetcdfFile.java:422)
... 16 more
I'm at a loss as to what to tell the user, as there's no further info presented
about what attribute it is that has a null value. It would be of some help if
the exception would also report the name/key of the problem attribute.
A copy of the dataset is currently at
http://www.giss.nasa.gov/staff/rschmunk/data/20130917_153410_.grb
BTW: I commented last March that I had been having since the start of the year with GRIB
temporary files popping up in the same directory as the GRIB file rather than in the
cache dir specified by DiskCache.setRootDirectory(). I thought this was "fixed"
in 4.3.18 but that was mistaken. On further exploration today, I found that a deliberate
change was made in 4.3.15, as described at
http://www.unidata.ucar.edu/software/thredds/current/netcdf-java/reference/Caching.html
However, although that webpage states that as of 4.3.15 one should use
DiskCache2 class to deal with GRIB files, the section terminates before
providing an example of the DiskCache2 options. I did find an example in the
source code for the TestGribDiskCache class which gave me the help I needed.