Sophie

Sophie

distrib > Fedora > 14 > x86_64 > media > os > by-pkgid > 4b194777eaf705e440bb2ce282d32772 > files > 562

GMT-doc-4.5.3-3.fc14.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

<!--Converted with LaTeX2HTML 2002-2-1 (1.71)
original version by:  Nikos Drakos, CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>7.17 Images clipped by coastlines</TITLE>
<META NAME="description" CONTENT="7.17 Images clipped by coastlines">
<META NAME="keywords" CONTENT="GMT_Docs">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">

<META NAME="Generator" CONTENT="LaTeX2HTML v2002-2-1">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">

<LINK REL="STYLESHEET" HREF="GMT_Docs.css">

<LINK REL="next" HREF="node139.html">
<LINK REL="previous" HREF="node137.html">
<LINK REL="up" HREF="node121.html">
<LINK REL="next" HREF="node139.html">
</HEAD>

<BODY  bgcolor="#ffffff">
<!--Navigation Panel-->
<A NAME="tex2html4588"
  HREF="node139.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html4582"
  HREF="node121.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html4576"
  HREF="node137.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html4584"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html4586"
  HREF="node256.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html4589"
  HREF="node139.html">7.18 Volumes and Spatial</A>
<B> Up:</B> <A NAME="tex2html4583"
  HREF="node121.html">7. Creating GMT Graphics</A>
<B> Previous:</B> <A NAME="tex2html4577"
  HREF="node137.html">7.16 Gridding of data,</A>
 &nbsp; <B>  <A NAME="tex2html4585"
  HREF="node1.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html4587"
  HREF="node256.html">Index</A></B> 
<BR>
<BR>
<!--End of Navigation Panel-->

<H1><A NAME="SECTION0015170000000000000000"></A>
<A NAME="24534"></A>
<BR>
7.17 Images clipped by coastlines
</H1>

<P>
This example demonstrates how <A NAME="tex2html1432"
  HREF="../man/pscoast.html"><I><B>pscoast</B></I></A><A NAME="25353"></A> can be used
to set up clip paths 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 <A NAME="tex2html1433"
  HREF="../man/grdimage.html"><I><B>grdimage</B></I></A><A NAME="25358"></A>, use <A NAME="tex2html1434"
  HREF="../man/pscoast.html"><I><B>pscoast</B></I></A><A NAME="25363"></A> to set up land
clip paths, and then overlay topography from the ETOPO5 data
set with another call to <A NAME="tex2html1435"
  HREF="../man/grdimage.html"><I><B>grdimage</B></I></A><A NAME="25368"></A>.  We finally undo
the clippath with a second call to <A NAME="tex2html1436"
  HREF="../man/pscoast.html"><I><B>pscoast</B></I></A><A NAME="25373"></A> with the
option <B>-Q</B> (Figure&nbsp;<A HREF="#fig:GMT_example_17">7.17</A>): 

<P>
<BR CLEAR="ALL">
<HR>
<BR>
<PRE>#!/bin/sh
#               GMT EXAMPLE 17
#
# Purpose:      Illustrates clipping of images using coastlines
# GMT progs:    grd2cpt, grdgradient, grdimage, pscoast, pstext
# Unix progs:   rm
#
ps=example_17.ps

# First generate geoid image w/ shading

grd2cpt india_geoid.nc -Crainbow &gt; geoid.cpt
grdgradient india_geoid.nc -Nt1 -A45 -Gindia_geoid_i.nc
grdimage india_geoid.nc -Iindia_geoid_i.nc -JM6.5i -Cgeoid.cpt -P -K \
        -U"Example 17 in Cookbook" &gt; $ps

# Then use pscoast to initiate clip path for land

pscoast -Rindia_geoid.nc -J -O -K -Dl -Gc &gt;&gt; $ps

# Now generate topography image w/shading

echo "-10000 150 10000 150" &gt; gray.cpt
grdgradient india_topo.nc -Nt1 -A45 -Gindia_topo_i.nc
grdimage india_topo.nc -Iindia_topo_i.nc -J -Cgray.cpt -O -K &gt;&gt; $ps

# Finally undo clipping and overlay basemap

pscoast -R -J -O -K -Q -B10f5:."Clipping of Images": &gt;&gt; $ps

# Put a color legend on top of the land mask

psscale -D4i/7.6i/4i/0.2ih -Cgeoid.cpt -B5f1/:m: -I -O -K &gt;&gt; $ps

# Add a text paragraph

pstext -R -J -O -m -Wwhite,Othinner -D-0.1i/0.1i &gt;&gt; $ps &lt;&lt; END
&gt; 90 -10 12 0 4 RB 12p 3i j
@_@%5%Example 17.@%%@_  We first plot the color geoid image
for the entire region, followed by a gray-shaded @#etopo5@#
image that is clipped so it is only visible inside the coastlines.
END

# Clean up

rm -f geoid.cpt gray.cpt *_i.nc .gmt*
</PRE>
<BR CLEAR="ALL">
<HR>
<DIV ALIGN="CENTER"><A NAME="fig:GMT_example_17"></A><A NAME="25380"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 7.17:</STRONG>
Clipping of images using coastlines.</CAPTION>
<TR><TD>
<DIV ALIGN="CENTER"><IMG
 WIDTH="430" HEIGHT="510" ALIGN="BOTTOM" BORDER="0"
 SRC="img178.png"
 ALT="\includegraphics[scale=0.5]{scripts/example_17}"></DIV></TD></TR>
</TABLE>
</DIV>

<P>
We also plot a color legend on top of the land. So here we basically have three
layers of ``paint'' stacked on top of each other: the underlaying geoid map,
the land mask, and finally the color legend. This legend makes clear how
<A NAME="tex2html1437"
  HREF="../man/grd2cpt.html"><I><B>grd2cpt</B></I></A><A NAME="25385"></A> distributed the colors over the range: they are not of equal
length put are associated with equal amounts of area in the plot. Since the high
amounts (in red) are not very prevalent, that color spans a long range.

<P>
For this image it is appropriate to use the <B>-I</B> option in <A NAME="tex2html1438"
  HREF="../man/psscale.html"><I><B>psscale</B></I></A><A NAME="25391"></A>
so the legend gets shaded, similar to the geoid grid.
See Appendix&nbsp;<A HREF="node235.html#app:M">M</A> to learn more about color palettes and ways to draw color legends.

<P>
<A NAME="24549"></A>

<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html4588"
  HREF="node139.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html4582"
  HREF="node121.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html4576"
  HREF="node137.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html4584"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html4586"
  HREF="node256.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html4589"
  HREF="node139.html">7.18 Volumes and Spatial</A>
<B> Up:</B> <A NAME="tex2html4583"
  HREF="node121.html">7. Creating GMT Graphics</A>
<B> Previous:</B> <A NAME="tex2html4577"
  HREF="node137.html">7.16 Gridding of data,</A>
 &nbsp; <B>  <A NAME="tex2html4585"
  HREF="node1.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html4587"
  HREF="node256.html">Index</A></B> 
<!--End of Navigation Panel-->
<ADDRESS>
Paul Wessel
2010-07-14
</ADDRESS>
</BODY>
</HTML>