[gdal-dev] GDAL Navigation of a Grib2 file

Frank Warmerdam warmerdam at pobox.com
Mon Nov 15 13:41:54 EST 2010

Cassanova, Bill wrote:
> *        lat 41.297283 to 61.504407 by 0.011232*
> *        lon 336.472121 to 26.804594 by 0.011232* #points=8061319
> Origin = (336.472120999999959,61.492418999999998)

> My question is….How does GDAL calculate its dimensional constraints?  I 
> would have assumed that it read it right from the grib2 file.


Oddly the origin matches in longitude and is approximately 1 pixel off in

GDAL uses a "pixel is area" model while I suspect grib uses a "pixel is
point" model so normally there would be a half pixel offset between the
corners reported by GDAL and grib utilities.  However, I am uncertain why
it is off by one pixel in one direction and pretty much dead on in the other.
This suggests a bug.

I would suggest you review existing GRIB tickets to see if this issue has
already been raised, and perhaps even resolved.  If it is not mentioned then
please file a ticket.  If there is an unresolved ticket you could add your
information to the ticket.

GRIB is a bear of a format, so it is not always easy to get someone to work
on the tickets.  And for this sort of problem there is always a risk of
fixing things for one file and breaking it for another.

Best regards,
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent

More information about the gdal-dev mailing list