Re: [netcdf-java] 2 fix on GRIB1 reader

Hi johann :

Thanks very much, these fixes will be in target-4.3.14 later tonight.


On 10/31/2012 5:41 AM, johann sorel wrote:

I work with martin desruisseaux on the project.

While trying to access datas from : I found a few bugs in
the grib1 to netcdf metamodel.
Those are GRIB 1 files with LatLon projections.


There was 2 bugs in this projection creation :

1 - a copy/paste error when calculating the latitude delta.

if (!Misc.closeEnough(deltaLat, calcDelta)) {
   log.debug("deltaLat != calcDeltaLat");
   deltaLat = calcDelta;  ----> was deltaLon = calcDelta;

2 - wrong value order when datas start by the lower values.

   if (deltaLat != GribNumbers.UNDEFINED) {
         deltaLat *= scale3; // undefined for thin grids
         if (la2 < la1) deltaLat *= -1.0;
   } else deltaLat = calcDelta;

     if (deltaLat != GribNumbers.UNDEFINED) {
         deltaLat *= scale3; // undefined for thin grids
         if (la2 < la1) {
             //flip declaration order
             float latemp = la1;
             la1 = la2;
             la2 = latemp;
             calcDelta *= -1.0;

             //we must also consider the cell corner, since we flipped
the order
             //we should specify that the true value is at the
             //but we can't show this information so we make a one cell
             //to move the value on a TOP-LEFT corner.
             la1 -= calcDelta;
             la2 -= calcDelta;
       } else {
           deltaLat = calcDelta;

I attached a snapshot of the visualized datas before and after fix over
the indian ocean and the patched java class.

Johann Sorel

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

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