JGRIB


JGrib is a java library to read/decode GRIB files.
This library also supports different parameter tables, which is read in before the data is read.
The project is hosted under sourceforge
This library was originally written by Benjamin Stark as part of a diploma thesis for Universität Osnabrück

Getting help: Check our help forum

Installation:

Usage:

The main access point to GRIB data is through the GribFile class. When the GRIB file is opened, parts of the file content is decoded (IS, GDS, PDS section) and the rest of the data is stored compressed inside this class.  

From this class one can query the content of the file and access the content of GRIB records through the GribRecord class. You can get values, gridCoords, type, time, unit and level from this class. For example usage, see classes in the examples diretory found in the jgrib_src.jar file.

The library handles several grib tables simultaneously. 
Sample code:
try {
  GribFile grb = new GribFile("path/to/file.grb");
} catch (FileNotFoundException noFileError) {
  System.err.println("FileNotFoundException : " + noFileError);
} catch (IOException ioError) {
  System.err.println("IOException : " + ioError);
} catch (NoValidGribException noGrib) {
  System.err.println("NoValidGribException : " + noGrib);
} catch (NotSupportedException noSupport) {
  System.err.println("NotSupportedException : " + noSupport);
}

Debugging using Log4J

JGRIB uses Log4J for debugging. This is why you must include Log4J in your classpath.
If you don't configure Log4J in you own code JGRIB will silently turn off logging.
JGRIB only uses the Level.DEBUG internally, so if you don't include debugging you will not see any messages from JGRIB.

Projections:

The library support a limmited amount of the projections defined in the GRIB standard. This is due to the fact, that the code cannot be stable when applied to projections, that we don't have access to.
Current supported projections:
The GribRecordGDS objects are constructed using the GribGDSFactory.

GRIBTAB tables:

JGRIB is following the standard set by Wesley Ebisuzaki (author of wgrib)
EXCEPTION: Only one table in a file, not several as in wgrib
Several tables are included among them you will find:
To expand with your own GRIBTAB table you can do it by setting the JAVA system property: GribTabURL

// Set gribtab property to JGRIB library
File gribTab = new File("gribTabPath");
System.setProperty("GribTabURL",gribTab.toURL().toString());

History:

  SourceForge Logo

Last update: $Id: main.php,v 1.2 2006/08/11 19:34:58 frv_peg Exp $