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 = reader.next();
// do good stuff
}
raf.close();
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 = scan.next();
// do stuff
}
raf.close();
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
John
On 2/21/2014 4:42 AM, Martijn van der Pauw wrote:
Hi,
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,
Martijn
_______________________________________________
netcdf-java mailing list
netcdf-java@xxxxxxxxxxxxxxxx
For list information or to unsubscribe, visit:
http://www.unidata.ucar.edu/mailing_lists/