[gdal-dev] GDAL Navigation of a Grib2 file

Cassanova, Bill BCassanova at weather.com
Mon Nov 15 12:41:08 EST 2010


HI All,

 

I think I may have discovered a slight issue with how GDAL reads GRIB2
files.

 

I created a grib2 file using a third party utility with the following
parameters:

 

  cell_size_x = 0.011232419944023

  cell_size_y = 0.011232419944023

  lat_lower_left = 41.2972846

  lon_lower_left = -23.5278783

  lat_upper_right = 61.5044080

  lon_upper_right = 26.8045955

  rows = 1799;

  columns = 4481

 

When I look at the grid dimensions using wgrib2 I see that the corner
points match exactly:

 

1:0:grid_template=0:winds(N/S):

        lat-lon grid:(4481 x 1799) units 1e-06 input WE:SN output WE:SN
res 48

        lat 41.297283 to 61.504407 by 0.011232

        lon 336.472121 to 26.804594 by 0.011232 #points=8061319

 

When I dump the same grid using gdalinfo it's corner points show up
differently:

 

Driver: GRIB/GRIdded Binary (.grb)

Files: image_combine_20101115164227.grib2

Size is 4481, 1799

Coordinate System is:

GEOGCS["Coordinate System imported from GRIB file",

    DATUM["unknown",

        SPHEROID["Sphere",6367470,0]],

    PRIMEM["Greenwich",0],

    UNIT["degree",0.0174532925199433]]

Origin = (336.472120999999959,61.492418999999998)

Pixel Size = (0.011232000000000,-0.011232000000000)

Corner Coordinates:

Upper Left  (     336.472,      61.492) (336d28'19.64"E, 61d29'32.71"N)

Lower Left  (     336.472,      41.286) (336d28'19.64"E, 41d17'9.78"N)

Upper Right (     386.803,      61.492) (386d48'9.77"E, 61d29'32.71"N)

Lower Right (     386.803,      41.286) (386d48'9.77"E, 41d17'9.78"N)

Center      (     361.637,      51.389) (361d38'14.70"E, 51d23'21.25"N)

 

I thought that GDAL used degrib to extract the Grib information and so I
also dumped the file with degrib and it matches the wgrib2 output as it
should:

 

GDS | Number of Points | 8061319

GDS | Projection Type | 0 (Latitude/Longitude)

GDS | Shape of Earth | sphere

GDS | Radius | 6367.470000 (km)

GDS | Nx (Number of points on parallel) | 4481

GDS | Ny (Number of points on meridian) | 1799

GDS | Lat1 | 41.297440

GDS | Lon1 | 334.942119

GDS | u/v vectors relative to | easterly/northerly

GDS | Lat2 | 61.504407

GDS | Lon2 | 25.274208

GDS | Dx | 0.011199 (degrees)

GDS | Dy | 0.011199 (degrees)

 

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

 

Thanks,

Bill

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/gdal-dev/attachments/20101115/bcf78c2e/attachment.html


More information about the gdal-dev mailing list