Opened 19 years ago
Closed 11 years ago
#796 closed defect (worksforme)
gdalinfo reports wrong values on GMT grid regisred grids
Reported by: | Owned by: | warmerdam | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | default | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: | Markus Neteler, Kyle Shannon |
Description (last modified by )
Regarding GMT grids, gdalinfo gives uncorrect results. This creates a grid with a grid step of 1 grdmath -R-15/15/-15/15 -I1 = lixo.grd Runing grdinfo tells us lixo.grd: Title: lixo.grd: Command: grdmath -R-15/15/-15/15 -I1 = lixo.grd lixo.grd: Remark: lixo.grd: Normal node registration used lixo.grd: grdfile format # 0 lixo.grd: x_min: -15 x_max: 15 x_inc: 1 units: user_x_unit nx: 31 lixo.grd: y_min: -15 y_max: 15 y_inc: 1 units: user_y_unit ny: 31 lixo.grd: z_min: 0 z_max: 0 units: user_z_unit lixo.grd: scale_factor: 1 add_offset: 0 However gdalinfo says: Driver: GMT/GMT NetCDF Grid Format Size is 31, 31 Coordinate System is `' Origin = (-15.000000,15.000000) Pixel Size = (0.96774194,-0.96774194) Corner Coordinates: Upper Left ( -15.0000000, 15.0000000) Lower Left ( -15.0000000, -15.0000000) Upper Right ( 15.0000000, 15.0000000) Lower Right ( 15.0000000, -15.0000000) Center ( 0.0000000, 0.0000000) Note how the "Pixel Size" differs from 1 But, if we generate the GMT grid this way (a "pixel registerd" grid) grdmath -R-15/15/-15/15 -I1 -F = lixo.grd than grdinfo reports lixo.grd: Title: lixo.grd: Command: grdmath -R-15/15/-15/15 -I1 -F = lixo.grd lixo.grd: Remark: lixo.grd: Pixel node registration used lixo.grd: grdfile format # 0 lixo.grd: x_min: -15 x_max: 15 x_inc: 1 units: user_x_unit nx: 30 lixo.grd: y_min: -15 y_max: 15 y_inc: 1 units: user_y_unit ny: 30 lixo.grd: z_min: 0 z_max: 0 units: user_z_unit lixo.grd: scale_factor: 1 add_offset: 0 and gdalinfo now gives the correct pixel size. Driver: GMT/GMT NetCDF Grid Format Size is 30, 30 Coordinate System is `' Origin = (-15.000000,15.000000) Pixel Size = (1.00000000,-1.00000000) Corner Coordinates: Upper Left ( -15.0000000, 15.0000000) Lower Left ( -15.0000000, -15.0000000) Upper Right ( 15.0000000, 15.0000000) Lower Right ( 15.0000000, -15.0000000) Center ( 0.0000000, 0.0000000) What seams to be happening is that gdal assumes all grids have a "pixel registration". And that is not allways true, in what ragards GMT grids, but it is also not true for example with GTOPO30 (or SRTM30) and SRTM 1-arc-sec or SRTM 3-arc-sec. The first are pixel registerd, but the seconds are grid registerd. See http://gmt.soest.hawaii.edu/gmt/doc/html/GMT_Docs/node145.html for a explanation on the difference between "grid" and "pixel" registrations.
Attachments (1)
Change History (5)
by , 19 years ago
comment:1 by , 19 years ago
Supporting information. ... Frank, The point with GMT grids (but it doesn't restrict only to them) is that grids can have both models. That's what GMT calls the grid and pixel registration. The information on which model is used is contained in the GMT header "Normal node registration used" for grid registration, or pixel-is-point, and "Pixel node registration" (I think) in the other case. Joaquim Frank GMT '.grd. files can be either 'line' or 'pixel' oriented see the "node_offset" member in the GRD_HEADER struct This is in "gmt_grd.h" http://gmt.soest.hawaii.edu/gmt/doc/html/GMT_Docs/node144.html HTH
comment:2 by , 14 years ago
Cc: | added |
---|
comment:3 by , 13 years ago
Cc: | added; removed |
---|---|
Description: | modified (diff) |
comment:4 by , 11 years ago
Priority: | high → normal |
---|---|
Resolution: | → worksforme |
Status: | new → closed |
Seems to be fixed in trunk:
kyle@kyle-workstation:796$ gdalinfo lixo.grd Driver: GMT/GMT NetCDF Grid Format Files: lixo.grd Size is 31, 31 Coordinate System is `' Origin = (-15.500000000000000,15.500000000000000) Pixel Size = (1.000000000000000,-1.000000000000000) Corner Coordinates: Upper Left ( -15.5000000, 15.5000000) Lower Left ( -15.5000000, -15.5000000) Upper Right ( 15.5000000, 15.5000000) Lower Right ( 15.5000000, -15.5000000) Center ( 0.0000000, 0.0000000) Band 1 Block=31x1 Type=Float32, ColorInterp=Undefined
Closing, not a lot of attention for about 8 years (other than me). Reopen if need be.
Note:
See TracTickets
for help on using tickets.
Sample Grid with grid registered convention.