Correspondence from Paul Wessel about plotting phase 2-D

             Re: phase data
             Tue, 2 Mar 1999 23:12:32 -1000
             Paul Wessel <>
             Hans-Georg Scherneck <hgs>
             1 , 2

>(1) I'd like to get complex data into preferably one grd file.

That will require a full redefinition of what grdfiles may contain
and won't happen anytiome soon (it may be addressed in the future when
we consider expanding the format to allow for 3-D data cubes).

In the mean time you will have to use 2 grids.  In separate mails
I am sending you, a color amplitude plot with phase contours,
and the GMT 3.2 script that made it.  Pls comment if the plot looks
as expected; of course you cannot run the script but notice the -Zp
option to grdcontour.


Paul Wessel, Professor
Dept. of Geology & Geophysics
School of Ocean & Earth Science & Technology
University of Hawaii at Manoa
1680 East-West Road,
Honolulu, HI 96822
(808) 956-4778/5154 (voice/fax)

# Amplitude/phase plot of M2 ocean tide
# Make real and imag grids
awk '{print $1, $2, $5}' | xyz2grd -R-560/660/-560/600 -I20 -Greal.grd -V
awk '{print $1, $2, $6}' | xyz2grd -R -I20 -Gimag.grd -V
#Get amp and phase grids
grdmath imag.grd real.grd HYPOT = amp.grd
grdmath imag.grd real.grd ATAN2 180 MUL PI DIV = phase.grd
grd2cpt amp.grd > amp.cpt
echo 'N 255' >> amp.cpt
grdimage amp.grd -Jx0.0055 -Camp.cpt -P -B100WSne:."M@-2@- ocean tide (amp + phase)": -K >
grdcontour phase.grd -C10 -A30 -G0.5 -Zp -Jx0.0055 -O -N\\312 -V >>
gv &

\rm -f imag.grd real.grd amp.grd phase.grd amp.cpt

Look at the beautiful result