[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Fwd: [netcdf-java] grib2 read error]




comments below.




-------- Original Message --------
Subject: [netcdf-java] grib2 read error
Date: Wed, 21 Jan 2009 23:34:54 -0500
From: Sachin Kumar Bhate <address@hidden>
Reply-To: address@hidden
Organization: Mississippi State University-Northern Gulf Institute
To: address@hidden

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)


Sachin,

This was an unusal report, the problem is a corrupt file, not NcML

file multi_1.at_4m.hs.200502.grb2 has a bad data section in the following record from the index. I believe it's
Significant Height of swell waves.


0 10 0 8 2 241 1.0 255 0.0 2005-02-01T00:00:00Z 3 1391515031 21097354 21097426

Since the corruption is at valid time 3, that why later offset probably worked ok.

In the future if you see this problem again, use ToolsUI to display the data. I going to make the jpeg decoder catch these errors, return a error message and set the data values to the missing values.

Robb...

   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/



_______________________________________________
netcdf-java mailing list
address@hidden
For list information or to unsubscribe, visit: 
http://www.unidata.ucar.edu/mailing_lists/


===============================================================================
Robb Kambic                                Unidata Program Center
Software Engineer III                      Univ. Corp for Atmospheric Research
address@hidden             WWW: http://www.unidata.ucar.edu/
===============================================================================