[Gdal-dev] using gdal_translate -of GMT

Peter Morgan petermorgan at grapevine.net.au
Tue Jan 16 16:07:53 EST 2007


Dear GDAL
recently in the GMT users group the GDAL translator was mentioned as a 
way of importing into GMT data from the USGS seamless server.

I went away and installed GDAL on my Centos 4.4 operating system hoping 
to test this appealing approach.
I use a 32 bit AMD chip on my machine.

I then went to the USGS seamless server and extracted an image.
running gdalinfo on the data set produces a nice lot of meta data.
Here is a copy

[peterm at currawong 76906435]$ /usr/local/bin/gdalinfo w001001.adf
Driver: AIG/Arc/Info Binary Grid
Size is 2345, 1753
Coordinate System is:
GEOGCS["WGS 84",
   DATUM["WGS_1984",
       SPHEROID["WGS 84",6378137,298.257223563,
           AUTHORITY["EPSG","7030"]],
       TOWGS84[0,0,0,0,0,0,0],
       AUTHORITY["EPSG","6326"]],
   PRIMEM["Greenwich",0,
       AUTHORITY["EPSG","8901"]],
   UNIT["degree",0.0174532925199433,
       AUTHORITY["EPSG","9108"]],
   AXIS["Lat",NORTH],
   AXIS["Long",EAST],
   AUTHORITY["EPSG","4326"]]
Origin = (113.557499994722235,5.295000001108752)
Pixel Size = (0.000833333333300,-0.000833333333300)
Corner Coordinates:
Upper Left  ( 113.5575000,   5.2950000)
Lower Left  ( 113.5575000,   3.8341667)
Upper Right ( 115.5116667,   5.2950000)
Lower Right ( 115.5116667,   3.8341667)
Center      ( 114.5345833,   4.5645833)
Band 1 Block=512x4 Type=Float32, ColorInterp=Undefined
 Min=-15.000 Max=2415.000
 NoData Value=-3.40282346638529e+38

The pixel size is consistent with 3 arc seconds. The width is 1.954167 
degrees which generates 2345 pixels as stated above.

I then ran
gdal_translate [peterm at currawong 76906435]$ gdal_translate w001001.adf 
-of GMT w001001.grd
Input file size is 2345, 1753
[peterm at currawong 76906435]$

The size is correct

now using grdinfo on the GMR grid file I get

[peterm at currawong 76906435]$ grdinfo w001001.grd
w001001.grd: Title:
w001001.grd: Command:
w001001.grd: Remark:
w001001.grd: Normal node registration used
w001001.grd: grdfile format: cf (# 10)
w001001.grd: x_min: 113.557 x_max: 115.512 x_inc: 0.000833333 name: 
meters nx: 2345
w001001.grd: y_min: 3.83417 y_max: 5.295 y_inc: 0.000833333 name: meters 
ny: 1753
w001001.grd: z_min: -15 z_max: 2415 name: meters
w001001.grd: scale_factor: 1 add_offset: 0
[peterm at currawong 76906435]$

Again the sizes are correct.
Initially I didn't pay too much attention to the grid sizes as I thought 
that it was "conventional" truncation as the
number of grids is what is necessary. However using the GMT info you get 
a longitude difference of 1.955 degrees which equates to 2346 pixels. 
One additional pixel.

Now testing with a simple GMT script which is as follows

#! /bin/tcsh -f
echo "test on Brunei data from USGS seamless"
#set up contouring
makecpt -Cjet  -T-50/1950/25  > topo.cpt
set region =  -R114./115.50/4./5.10
set map = -Jm15c
set base = -Ba15mf5mg5m/a15mf5mg5m
psbasemap $region $map $base                              -K      >  
test01.ps
pscoast   $region $map $base  -Df -Na -G230               -K -O   >> 
test01.ps
grdview   $region $map  w001001.grd  -Ctopo.cpt   -Qs   -Wc   -O  >> 
test01.ps
echo "done"


produces the following

test on Brunei data from USGS seamless
grdview: GMT Fatal Error: x-values are not monotonically 
increasing/decreasing!
grdview: GMT Fatal Error: x-values are not monotonically 
increasing/decreasing!
Segmentation fault
done

Hope that you can help me understand these issues
regards Peter

-- 
***************************************
*                                     *
*  Peter and Carol Morgan             *
*  20 Goodparla St                    *
*  Hawker, ACT, 2614                  *
*  Australia                          *
*                                     *
* Home Phone      +61 (0)2 6254 0137  *
* Peter's Mobile  +61 (0)4 1854 0137  *
*                                     *
***************************************




More information about the Gdal-dev mailing list