Changes between Version 4 and Version 5 of Ticket #1462
- Timestamp:
- Apr 8, 2007, 2:00:19 PM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #1462 – Description
v4 v5 1 {{{ 2 The out-by-1 problem with the GMT driver was again recently reported. It appears that this is quite an old problem as the initial postings to the GDAL community were made in 2005. The first appears to be #796 on 13 March 2004 by jluis. The second was on 15 April 2005 also by jluis. Another on November 18 2005, Rich Signal reports the same problem. 1 The out-by-1 problem with the GMT driver was again recently reported. It appears that this is quite an old problem as the initial postings to the GDAL community were made in 2005. 3 2 4 We have discussed the problem in the GMT community. GMT is able to support grid referenced data AND pixel registered data. We have routines to transfer between these if there is a need to do so. The use of grid referenced data in GMT is mainly historical so resampling can be very lossy especially at scales near the Nyquist frequency of the grid. Thus the solution to the problem may be to output the region of interest as a pixel registered grid and to make the header information consistent with this option. What I am attempting to say here is that the GMT community is not locked into a grid reference model when the underlying data set is pixel registered. grdinfo in GMT will return the type of grid that is being used so the onus can be placed on the GMT community to understand the imported grid. 3 The first appears to be #796 on 13 March 2004 by jluis. 4 The second was on 15 April 2005 also by jluis. 5 Another on November 18 2005, Rich Signal reports the same problem. 5 6 7 We have discussed the problem in the GMT community. GMT is able to support grid referenced data AND pixel registered data. We have routines to transfer between these if there is a need to do so. 6 8 9 The use of grid referenced data in GMT is mainly historical so resampling can be very lossy especially at scales near the Nyquist frequency of the grid. Thus the solution to the problem may be to output the region of interest as a pixel registered grid and to make the header information consistent with this option. 10 11 What I am attempting to say here is that the GMT community is not locked into a grid reference model when the underlying data set is pixel registered. grdinfo in GMT will return the type of grid that is being used so the onus can be placed on the GMT community to understand the imported grid. 7 12 8 13 For these tests I cut from the USGS Seamless server the following region using the direct entry of the region of interest. 9 14 15 {{{ 10 16 | | 11 17 | | … … 19 25 113 59 00.000 115 01 00.000 20 26 (113.98333333) (115.01666667) 21 27 }}} 22 28 23 29 Using gdalinfo on the returned file we see the following 30 31 {{{ 24 32 [peterm@currawong 16733119]$ gdalinfo w001001.adf 25 33 Driver: AIG/Arc/Info Binary Grid … … 50 58 Min=-7.000 Max=2371.000 51 59 NoData Value=-3.40282346638529e+38 60 }}} 52 61 53 Note that the subtle difference between the definition of the origin and the Upper Left corner definition is a numeric 54 problem. There are indeed 1240 cells, (columns) from 113.9833333 to 115.0166667 similarly there are 1240 cells, (rows), from 62 Note that the subtle difference between the definition of the origin and the Upper Left corner definition is a numeric problem. 63 64 There are indeed 1240 cells, (columns) from 113.9833333 to 115.0166667 similarly there are 1240 cells, (rows), from 55 65 3.9833333 to 5.0166667. These cells are 0.000833333333300 degrees which is equivalent to 3 arc seconds. 56 66 This indicates that we do indeed have a pixel registered data set. 57 67 58 Running the routine gdal_translate [peterm@currawong 16733119]$ gdal_translate w001001.adf -of GMT w001001.gmt 68 Running the routine gdal_translate 69 70 {{{ 71 [peterm@currawong 16733119]$ gdal_translate w001001.adf -of GMT w001001.gmt 59 72 Input file size is 1240, 1240 60 [peterm@currawong 16733119]$ 73 }}} 74 61 75 says that the input file size was 1240-by-1240 62 76 Now we can get information on the output file by two methods: 63 1. using gdalinfo64 77 78 '''1. using gdalinfo''' 79 80 {{{ 65 81 [peterm@currawong 16733119]$ gdalinfo w001001.gmt 66 82 Driver: GMT/GMT NetCDF Grid Format … … 76 92 Center ( 114.5000000, 4.5000000) 77 93 Band 1 Block=1240x1 Type=Float32, ColorInterp=Undefined 94 }}} 78 95 79 96 Notice that the cell size is no longer 0.00083333333 but .000834005918718. 80 This change in size is coupled with changes in the origin which is now 81 (113.982916325079145,5.017083670745943) which is97 98 This change in size is coupled with changes in the origin which is now (113.982916325079145,5.017083670745943) which is 82 99 113 58 58.498 5 01 01.5012 83 The lower right corner is ( 115.0170837, 3.9829163) or 115 01 01.501, 03 58 58.49868 84 The longitude difference of 1.034167 corresponds to 1241 cells when the size is 0.00083333 100 The lower right corner is 101 ( 115.0170837, 3.9829163) 102 or 103 115 01 01.501, 03 58 58.49868 104 The longitude difference of 1.034167 corresponds to 1241 cells when the size is 0.00083333 85 105 or 1240 cells when the size is 0.00083400591871 86 106 A similar computation results for latitude. … … 88 108 This is a bastard system as it appears that the origins have been adjusted to move from pixel to grid registration but that is all. To make things consistent the cell width has be modified. 89 109 90 2. getting information with grdinfo a GMT command. 110 '''2. getting information with grdinfo a GMT command.''' 111 112 {{{ 91 113 [peterm@currawong 16733119]$ grdinfo w001001.gmt 92 114 w001001.gmt: Title: … … 99 121 w001001.gmt: z_min: -7.000000e+00 z_max: 2.371000e+03 name: meters 100 122 w001001.gmt: scale_factor: 1.000000e+00 add_offset: 0.000000e+00 123 }}} 101 124 102 125 Here the grid size is 0.0008333 and the number of grid cells is 1240-by-1240. … … 105 128 I am a little puzzled that these two info routines return different information. I presume that this is because they interrogated different parts of the header. 106 129 107 108 130 It is hypothesised that the GDAL routines have failed to output the additional row and column that result from a conversion from a pixel registered grid to a grid reference grid. The correct process of transforming between these two grid types involves some form of resampling which is why the initial grid should be oversized if the process is pixed to reference grid. 109 }}}