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

Hi johann :

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

John

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

I work with martin desruisseaux on the geotoolkit.org project.

While trying to access datas from :
http://www.globalmarinenet.com/grib_downloads.php I found a few bugs in
the grib1 to netcdf metamodel.
Those are GRIB 1 files with LatLon projections.

grib/src/main/java/ucar/nc2/grib/grib1/Grib1Gds.java$LatLon

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.

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

AFTER
     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
BOTTOM-LEFT corner
             //but we can't show this information so we make a one cell
displacement
             //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
Geomatys





_______________________________________________
netcdf-java mailing list
netcdf-java@xxxxxxxxxxxxxxxx
For list information or to unsubscribe, visit: 
http://www.unidata.ucar.edu/mailing_lists/




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