JGribX is a GRIB decoder written in Java. It is essentially a fork of JGrib, which as far as I know is now no longer being actively developed. JGribX currently supports both GRIB-1 and GRIB-2 files.
The main objective of JGribX is to create an easy-to-use interface to extract data from GRIB files. The simplistic interface can be observed from the following code snippet (omitting extra stuff such as try-catches):
/* Get the temperature at an isobaric level of 200 hPa above Valletta, Malta at 6th November 2017 14:00:00 */
GribFile gribFile = new GribFile("filename.grb"); // typically .grb or .grb2 extension
Calendar forecastDate = new GregorianCalendar(2017, 10, 6, 14, 0, 0); // 6th November 2017 14:00:00
String parameterCode = "TMP"; // parameter code for temperature
String ltvid = "ISBL:200"; // LTVID (level type-value ID)
double latitude = 35.8985; // latitude at point of interest (Valletta, Malta)
double longitude = 14.5133; // longitude at point of interest (Valletta, Malta)
GribRecord record = gribFile.getRecord(forecastDate, parameterCode, ltvid);
double value = record.getValue(latitude, longitude);
Here is a shortlist of the major changes made since JGrib (version 7 beta):
- supports grid definition values given as south latitude and west longitude
- looks up parameter information from locally stored Grib Parameter Tables (GPT) (instead of a single hardcoded GPT)
- supports GRIB-2 files
JGribX is still under active development and therefore contains a large amount of unsupported features and operations. These will be implemented gradually over time. If you would like certain features to be implemented, please open an issue containing all the relevant information.
To uniquely identify and represent different parameters, each parameter has been given its own code. A list of parameter codes can be viewed here.
Similar to parameter codes, level codes are used to uniquely identify each level type and value(s). For example, an isobaric level is represented by the code ISBL. In addition, an isobaric level of 200 hPa is represented by the level type-value ID (LVID) ISBL:200. A list of level codes can be viewed here.