next up previous contents index
Next: Volumes and Spatial Selections Up: Cook-book Previous: Gridding of data, continued

   
Images clipped by coastlines

This example demonstrates how pscoast  can be used to set up clippaths based on coastlines. This approach is well suited when different gridded data sets are to be merged on a plot using different color palette files. Merging the files themselves may not be doable since they may represent different data sets, as we show in this example. Here, we lay down a color map of the geoid field near India with grdimage , use pscoast  to set up land clippaths, and then overlay topography from the ETOPO5 data set with another call to grdimage . We finally undo the clippath with a second call to pscoast  with the option -–Q (Figure 6.17):





#!/bin/csh
#        GMT EXAMPLE 17
#
#        @(#)job17.csh    1.8  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*






  
Figure 6.17: Clipping of images using coastlines
\begin{figure}\centering\epsfig{figure=eps/GMT_example_17.eps}\end{figure}

 



Paul Wessel
1999-03-25