Hello,
with 4.5.5 and 4.6.0-SNAPSHOT when I read a GRIB file and call
Variable.read() I get a NullPointerException. I've placed a copy of my
file at http://www.ral.ucar.edu/~braeckel/pgbh02.gdas.CLWMR.975mbar.grb2.
Here is my code:
GridDataset dataset = null;
try {
dataset = GridDataset.open( "pgbh02.gdas.CLWMR.975mbar.grb2");
System.out.println( "Opened "+dataset);
for( GridDatatype grid : dataset.getGrids() ){
Variable v = grid.getVariable();
Array a = v.read();
System.out.println("Read data for "+grid.getName());
}
} catch( IOException e ) {
e.printStackTrace();
}
if( dataset!=null)
dataset.close();
This results in the following NPE (this is 4.6.0-SNAPSHOT):
Exception in thread "main" java.lang.NullPointerException
at
ucar.nc2.grib.grib2.Grib2DataReader2.getData40(Grib2DataReader2.java:756)
at
ucar.nc2.grib.grib2.Grib2DataReader2.getData(Grib2DataReader2.java:117)
at ucar.nc2.grib.grib2.Grib2Record.readData(Grib2Record.java:327)
at ucar.nc2.grib.collection.Grib2Iosp.readData(Grib2Iosp.java:470)
at ucar.nc2.grib.collection.GribIosp$DataReader.read(GribIosp.java:1013)
at
ucar.nc2.grib.collection.GribIosp.readDataFromCollection(GribIosp.java:935)
at ucar.nc2.grib.collection.GribIosp.readData(GribIosp.java:880)
at ucar.nc2.NetcdfFile.readData(NetcdfFile.java:1980)
at ucar.nc2.Variable.reallyRead(Variable.java:868)
at ucar.nc2.Variable._read(Variable.java:839)
at ucar.nc2.Variable.read(Variable.java:717)
at ucar.nc2.dataset.VariableDS.reallyRead(VariableDS.java:523)
at ucar.nc2.dataset.VariableDS._read(VariableDS.java:507)
at ucar.nc2.Variable.read(Variable.java:717)
Have you seen this before?
Aaron