GRASS to GMT?

Has anyone written a GRASS script to dump a raster
grid into a format ready for GMT? I have been looking
for a good postscript tool for GRASS and think this
might be the way to go. It seems to me that it
wouldn't take much effort to tap into GMT's plotting
prowess by writing an r.out.gmt tool which would
format the GMT header by reading the WIND files and
then write out the binary stream in GMT format. This,
at least, would get us a good looking map. Maybe even
translating the colormap would be possible?!

=====
--
David Finlayson
david_finlayson@yahoo.com
University of Washington
Box 351310
Seattle, WA 98195 - 1310

__________________________________________________
Do You Yahoo!?
Yahoo! Messenger - Talk while you surf! It's FREE.
http://im.yahoo.com/

David

Has anyone written a GRASS script to dump a raster
grid into a format ready for GMT?

I did ...

It seems to me that it
wouldn't take much effort to tap into GMT's plotting
prowess by writing an r.out.gmt tool which would
format the GMT header by reading the WIND files and
then write out the binary stream in GMT format.

GMT (the Generic Mapping Tools) uses the NETcdf format
so such a program would make use of the NETcdf library
and might be better called r.out.cdf. gmt as a file
format is used by the "marine geophysical database"
supplementary GMT programs. From the "README.mgg":

        These programs are intended for use with the marine geophysical
data base files known as GMT-files. These GMT-files are written using
a native binary data format. These data files are NOT supplied with
GMT, but we provide you with a program (mgd77togmt) that allows you to
create your own GMT-files from the MGD-77 standard exchange format files
provided by the National Geophysical Data Center*.

I will try to remember it tonight at home to serach for the
script. Basically it is something like

#!/bin/csh -f

set reginc=`g.region -g | awk '{ (this-i-don't-remember) }'`
r.stats -1lg <rastermap> | xyz2grd -$reginc -Graster.grd

Maybe even translating the colormap would be possible?!

That would be nice, indeed!

Regards,

  Stephan

--
----------------------------------------------------------------------
Stephan Eickschen Tel. : +49 (0)8153 28-1351
GeoForschungsZentrum Potsdam (GFZ) Fax. : +49 (0)8153 28-1207
Division 1, Section 1.2
c/o email: eicksch@gfz-potsdam.de
DLR Oberpfaffenhofen www : http://op.gfz-potsdam.de
Box 1116
82234 Wessling
Germany
----------------------------------------------------------------------

David, Alejandro, Markus, and all

Has anyone written a GRASS script to dump a raster
grid into a format ready for GMT? I have been looking
for a good postscript tool for GRASS and think this
might be the way to go. It seems to me that it
wouldn't take much effort to tap into GMT's plotting
prowess by writing an r.out.gmt tool which would
format the GMT header by reading the WIND files and
then write out the binary stream in GMT format. This,
at least, would get us a good looking map. Maybe even
translating the colormap would be possible?!

Attached you will find a - very crude - script to "convert" GRASS
raster files to GMT readable netCDF files. I think that it is worth
to improve, but it has been a long time since I needed it and I am
currently not too much engaged with GRASS. Sorry...
But it works!!!!

Hope this helps,

  Stephan

--
----------------------------------------------------------------------
Stephan Eickschen Tel. : +49 (0)8153 28-1351
GeoForschungsZentrum Potsdam (GFZ) Fax. : +49 (0)8153 28-1207
Division 1, Section 1.2
c/o email: eicksch@gfz-potsdam.de
DLR Oberpfaffenhofen www : http://op.gfz-potsdam.de
Box 1116
82234 Wessling
Germany
----------------------------------------------------------------------

(attachments)

grass2gmt.sh (720 Bytes)