Unidata - To provide the data services, tools, and cyberinfrastructure leadership that advance Earth system science, enhance educational opportunities, and broaden participation. Unidata
         
  advanced  
 

Re: [netcdfgroup] How to read grib2 files using Netcdf Java API?

Hi Lak:

Im not having any trouble opening from either 4.0 or latest 2.2. Can you
recheck your classpath? Also 4.0 has got less bugs in it at this point, so you
might try it.

Valliappa Lakshmanan wrote:
> John, thanks for looking at this. The file (74MB) is now at:
>
> http://cimms.ou.edu/~lakshman/data/WRFPRS_GrbF21.grib2
>
> Lak
>
>
> On Fri, Dec 12, 2008 at 1:28 PM, John Caron <caron@xxxxxxxxxxxxxxxx
> <mailto:caron@xxxxxxxxxxxxxxxx>> wrote:
>
>     Hi Lak:
>
>     NetcdfDataset.open() should have worked.
>
>     Can you send us the file, and we'll check why its not working.
>
>     Valliappa Lakshmanan wrote:
>     > I know there must be a very simple way to do this, but I can't seem to
>     > find any example or documentation.
>     >
>     > I want to read a Grib2 file using the Java Netcdf API and tried:
>     >
>     > File file = new File("/tmp/WRFPRS_GrbF21.grib2");  // a grib2 file
>     > NetcdfFile ncfile = NetcdfDataset.open(file.getAbsolutePath());
>     >
>     > but get an IOException stating: Cant read
>     /tmp/WRFPRS_GrbF21.grib2: not
>     > a valid NetCDF file.
>     >
>     > I tried using ucar.dt.grid.GridDataSet.open() and got the same result.
>     >
>     > In case it was a classpath/jar problem, I added toolsUI.jar from
>     netcdf
>     > 2.2.22 to my classpath (has grib.jar).
>     > Same result.  What am I missing?
>     >
>     > thanks
>     > Lak
>     >
>     >
>     >
>     >
>     ------------------------------------------------------------------------
>     >
>     > _______________________________________________
>     > netcdfgroup mailing list
>     > netcdfgroup@xxxxxxxxxxxxxxxx <mailto:netcdfgroup@xxxxxxxxxxxxxxxx>
>     > For list information or to unsubscribe,  visit:
>     http://www.unidata.ucar.edu/mailing_lists/
>
>



 
 
  Contact Us     Site Map     Search     Terms and Conditions     Privacy Policy     Participation Policy
 
National Science Foundation (NSF) UCAR Community Programs   Unidata is a member of the UCAR Community Programs, is managed by the University Corporation for Atmospheric Research, and is sponsored by the National Science Foundation.
P.O. Box 3000     Boulder, CO 80307-3000 USA     Tel: 303-497-8643     Fax: 303-497-8690