Re: [netcdf-java] [Reduced gaussian] reading specifications

Hi Martin:

To access lower level GRIB1 reading, you use the classes in ucar.nc2.grib.grib1:

 RandomAccessFile raf = new RandomAccessFile(filepath, "r");
 Grib1RecordScanner reader = new Grib1RecordScanner(raf);
 while (reader.hasNext()) {
   ucar.nc2.grib.grib1.Grib1Record gr2 =;
   // do good stuff

or similarly for GRIB2, use the classes in ucar.nc2.grib.grib2:

RandomAccessFile raf = new RandomAccessFile(filepath, "r");
Grib2RecordScanner scan = new Grib2RecordScanner(raf);
 while (scan.hasNext()) {
   ucar.nc2.grib.grib2.Grib2Record gr1 =;
   // do stuff

Note that these are not supported public APIs, and are subject to change. But the low level stuff is pretty stable.

To read the data from a GRIB1 record:

  float[] data = gr1.readData(raf);

To read the data from a GRIB2 record:

Grib2SectionDataRepresentation drs = gr2.getDataRepresentationSection();
float[] data = gr2.readData(raf, drs.getStartingPosition());

to get at thin grids, you will want to look at and override or replace QuasiRegular.convertQuasiGrid


On 2/21/2014 4:42 AM, Martijn van der Pauw wrote:

We were wondering what’s the best way to read a reduced gaussian
gribfile and read the raw contents, so not the modified re-scaled grid.

For example, we want to be able to read the number of points for each
latitude for, but also other raw reduced Gaussian settings. (reading the
exact values of the grid points)

Kind regards,


netcdf-java mailing list
For list information or to unsubscribe, visit:

  • 2014 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: