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:
-
Download the source distribution file of your choice (.zip or .tar.gz)
- Unzip it to a local directory
- Include the jgrib.jar file, found in the lib folder
- Remember to include
Log4J
in your classpath
- Jgrib include a current version of
Log4J
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:
- Lat/Lon
- Rotated lat/lon
- Lambert Conformal
- Polar Sterographic
-
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:
- ncep_reanal_2 (centre 7, table 2) - DEFAULT
- ncep_reanal_1,3 (centre 7, table 1)
- emcwf_3 (centre 81, table 3)
- 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:
- 2006-08-01: Beta 7: (Peter Gylling,Tor Christian Bekkvik) -
Fixed several bugs, Reorganized code, Revised build/release system, Improved documentation
- 2003-03-15: Beta 6: (Rick Gonzales) -
Added support for projections and other improvements
- 2002-12-03: Beta 5: (Kjell Røang) -
Some rearrangement of code and tables
- 2002-12-02: Beta 4: (Tor Christian Bekkvik) -
Added handling of many grib tables
- 2002-04-29: Beta 3: (Kjell Røang) -
Fixed reading decimal scale - Added decoding of center and table
- 2002-04-22: Beta 2: (Peter Gylling) -
Fixed bug in GribFile getRecord - Added GribInfo class
- 2002-04-12: Beta 1: (Kjell Røang) -
First public release of jgrib
Last update: $Id: main.php,v 1.2 2006/08/11 19:34:58 frv_peg Exp $