NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

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

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
  • 2008 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdfgroup archives: