Re: [netcdf-java] Getting forecast times from grib file

On 1/17/2011 8:16 AM, Alexander Berkes wrote:
Hello,

I am really new to the netcdf-java library.

I am really stuck on getting the forecast times from a grib file.
Anything else works great (getting the lat/lon coordinate points,
getting the values or subsetting the grid...).

I tried the following:

------------------
String filename = "current.grb";

FmrcImpl forecasts = new FmrcImpl(filename);
List<Date>  forecastDates = forecasts.getForecastDates();

for(Date d : forecastDates){
     System.out.println(fd);
}
-----------------

But the above fails with a nullpointer exception on Object creation
(FmrcImpl forecasts = new FmrcImpl(filename);):
---------------------
Exception in thread "main" java.lang.NullPointerException
     at ucar.nc2.dt.fmrc.FmrcImpl$Gridset.<init>(FmrcImpl.java:264)
     at ucar.nc2.dt.fmrc.FmrcImpl.init(FmrcImpl.java:133)
     at ucar.nc2.dt.fmrc.FmrcImpl.<init>(FmrcImpl.java:85)
     at ucar.nc2.dt.fmrc.FmrcImpl.<init>(FmrcImpl.java:81)
     at Test.main(Test.java:62)
---------------------

Please can anybody help me on this?


Best regards,

Alex


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

Hi Alex:

Dont use FmcImpl, use GridDataset.open(filename);

see

http://www.unidata.ucar.edu/software/netcdf-java/tutorial/GridDatatype.html

for some simple examples.



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