Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.

Re: [netcdf-java] NPE when reading Grid Variable

  • To: Aaron Braeckel <braeckel@xxxxxxxx>
  • Subject: Re: [netcdf-java] NPE when reading Grid Variable
  • From: John Caron <caron@xxxxxxxx>
  • Date: Wed, 18 Mar 2015 09:09:48 -0600
HI Aaron: Im seeing the problem with that file, seems to be in the dark
matter of JJ2000 library. I will investigate asap. John

On Tue, Mar 17, 2015 at 5:24 PM, Aaron Braeckel <braeckel@xxxxxxxx> wrote:

> 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
>
> _______________________________________________
> netcdf-java mailing list
> netcdf-java@xxxxxxxxxxxxxxxx
> For list information or to unsubscribe, visit:
> http://www.unidata.ucar.edu/mailing_lists/
>
  • 2015 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: