#!/bin/bash
#		GMT EXAMPLE 17
#
#		@(#)job17.bash	1.5  03/11/99
#
# Purpose:	Illustrates clipping of images using coastlines
# GMT progs:	grd2cpt, grdgradient, grdimage, pscoast
# Unix progs:	rm
#
# Get Geoid and Topography for the region
#grdraster 1 -R60/90/-10/25 -Getopo5.grd
#grdraster 4 -R60/90/-10/25 -Ggeoid.grd

# First generate geoid image w/ shading

grd2cpt geoid.grd -Crainbow > geoid.cpt
grdgradient geoid.grd -Nt1 -A45 -Ggeoid_i.grd
grdimage geoid.grd -Igeoid_i.grd -JM6.5i -Cgeoid.cpt -P -K -U"Example 17 in Cookbook" > example_17.ps

# Then use pscoast to initiate clip path for land

pscoast -R60/90/-10/25 -JM -O -K -Dl -Gc >> example_17.ps

# Now generate topography image w/shading

echo "-10000 150 10000 150" > gray.cpt
grdgradient etopo5.grd -Nt1 -A45 -Getopo5_i.grd
grdimage etopo5.grd -Ietopo5_i.grd -JM -Cgray.cpt -O -K >> example_17.ps

# Finally undo clipping and overlay basemap

pscoast -R -JM -O -Q -B10f5:."Clipping of Images": >> example_17.ps

# Clean up

\rm -f geoid.cpt gray.cpt *_i.grd .gmt*