Opened 15 years ago
Closed 15 years ago
#3059 closed defect (worksforme)
gdalinfo on Surfer Grids is off by half grid cell
Reported by: | jluis | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | GDAL_Raster | Version: | svn-trunk |
Severity: | normal | Keywords: | GSBG |
Cc: |
Description (last modified by )
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 (3)
follow-up: 2 comment:1 by , 15 years ago
Component: | default → GDAL_Raster |
---|---|
Description: | modified (diff) |
Keywords: | GSBG added |
Status: | new → assigned |
comment:2 by , 15 years ago
Replying to warmerdam:
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.
Frank,
I guess the disagreement is exactly that. In my view the information should be faithful to what's in the file. And what is in there is x_min = 0, x_max = 10, ... For example, this thing started when I asked in Mirone the grid limits, and the info that came back to me was sinmply not correct. Since I'm interfacing with other code I thought the error was in my code. It turned out that it wasn't.
Joaquim
comment:3 by , 15 years ago
Resolution: | → worksforme |
---|---|
Status: | assigned → closed |
I'm afraid GDAL has to be true to it's own data model or else chaos would ensue.
I'm closing this on the assumption there is no problem with the driver. If you find it is wrong please reopen and further substantiate.
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.