[netcdf-java] grib2 read error

John,

I am trying to read a section of aggregated grib2 data files.
All subsets are read fine except when start index for time range
is '0'.

I have tested this with nj2.22 as well as 4.0 (developmental version).

A sample code is shown below.

>>>> start
String uri = ww3-multi.ncml;
String var='Significant_height_of_combined_wind_waves_and_swell';

            GridDataset gid = GridDataset.open(uri);
GeoGrid Grid = gid.findGridByName(var); Range trange = new Range(0,3,1); // start time index = 0 gives error, all other start time index have no problem
            Range yrange = new Range(1,20,1);
            Range xrange = new Range(1,40,2);

             GeoGrid subg = Grid.subset(trange,null,yrange,xrange);
VariableEnhanced ve= subg.getVariable();
            Array d = ve.read();
            gid.close();

<<<<<< end

I get this error..

java.lang.NullPointerException
at ucar.grib.grib2.Grib2DataSection.jpeg2000Unpacking(Grib2DataSection.java:797)
   at ucar.grib.grib2.Grib2DataSection.<init>(Grib2DataSection.java:131)
   at ucar.grib.grib2.Grib2Data.getData(Grib2Data.java:129)
at ucar.nc2.iosp.grib.Grib2ServiceProvider._readData(Grib2ServiceProvider.java:86) at ucar.nc2.iosp.grib.GribServiceProvider.readXY(GribServiceProvider.java:291) at ucar.nc2.iosp.grib.GribServiceProvider.readData(GribServiceProvider.java:253)
   at ucar.nc2.NetcdfFile.readData(NetcdfFile.java:1368)
   at ucar.nc2.Variable._read(Variable.java:926)
   at ucar.nc2.Variable.read(Variable.java:621)
   at ucar.nc2.ncml.Aggregation$Dataset.read(Aggregation.java:1250)
   at ucar.nc2.ncml.Aggregation.read(Aggregation.java:689)
   at ucar.nc2.dataset.VariableDS._read(VariableDS.java:277)
   at ucar.nc2.Variable.read(Variable.java:646)
   at SubsetGrid.main(SubsetGrid.java:55)


For test purposes the NcML and grib files (zipped) can be accessed via

http://www.gri.msstate.edu/rsearch_data/nopp/ww3-multi.zip

thanks,

-Sachin

--
Sachin Kumar Bhate, Research Associate
MSU-High Performance Computing Collaboratory, NGI
John C. Stennis Space Center, MS 39529
http://www.northerngulfinstitute.org/





  • 2009 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: