Opened 15 years ago

Last modified 15 years ago

#3059 closed defect

gdalinfo on Surfer Grids is off by half grid cell — at Version 1

Reported by: jluis Owned by: warmerdam
Priority: normal Milestone:
Component: GDAL_Raster Version: svn-trunk
Severity: normal Keywords: GSBG
Cc:

Description (last modified by warmerdam)

The info on grid size provided by gdalinfo on Surfer grids is wrong by half a grid cell. Example, generate one of such grids with GMT

grdmath -R0/10/1/14 -I1 = lixo.grd=sf

Run grdinfo 
grdinfo lixo.grd
lixo.grd: Title: Grid originally in Surfer 6 format
lixo.grd: Command:
lixo.grd: Remark:
lixo.grd: Gridline node registration used
lixo.grd: Grid file format: sf (# 6) Golden Software Surfer format 6 (float)

lixo.grd: x_min: 0 x_max: 10 x_inc: 1 name: x nx: 11
lixo.grd: y_min: 1 y_max: 14 y_inc: 1 name: y ny: 14
lixo.grd: z_min: 0 z_max: 0 name: z
lixo.grd: scale_factor: 1 add_offset: 0

Now run gdalinfo

C:\>gdalinfo lixo.grd
Driver: GSBG/Golden Software Binary Grid (.grd)
Files: lixo.grd
Size is 11, 14
Coordinate System is `'
Origin = (-0.500000000000000,14.500000000000000)
Pixel Size = (1.000000000000000,-1.000000000000000)
Corner Coordinates:
Upper Left  (  -0.5000000,  14.5000000)
Lower Left  (  -0.5000000,   0.5000000)
Upper Right (  10.5000000,  14.5000000)
Lower Right (  10.5000000,   0.5000000)
Center      (   5.0000000,   7.5000000)
Band 1 Block=11x1 Type=Float32, ColorInterp=Undefined
  Min=0.000 Max=0.000
  NoData Value=1.701410009187828e+038

The problem is that SURFER grids do not even have the concept of Pixel-is-area or pixel-registration, so the grid limits must always be given using the Pixel-is-point or grid node registration model.

Joaquim Luis

Change History (1)

comment:1 by warmerdam, 15 years ago

Component: defaultGDAL_Raster
Description: modified (diff)
Keywords: GSBG added
Status: newassigned

Joaquim,

GDAL always reports bounds in terms of a pixel-as-area model. It seems to me that GDAL is properly adjusting the origin by half a pixel as is required to convert from the pixel-as-point model of the grid to the model in GDAL.

So far I don't see any problem.

Note: See TracTickets for help on using tickets.