Sophie

Sophie

distrib > Fedora > 13 > i386 > by-pkgid > 5764c67416561ab82b35afcf9c650e17 > files > 568

GMT-doc-4.5.2-1.fc13.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.23 All great-circle paths lead to Rome</TITLE>
<META NAME="description" CONTENT="7.23 All great-circle paths lead to Rome">
<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="node144.html">
<LINK REL="previous" HREF="node142.html">
<LINK REL="up" HREF="node120.html">
<LINK REL="next" HREF="node144.html">
</HEAD>

<BODY  bgcolor="#ffffff">
<!--Navigation Panel-->
<A NAME="tex2html4624"
  HREF="node144.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html4618"
  HREF="node120.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html4612"
  HREF="node142.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html4620"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html4622"
  HREF="node255.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html4625"
  HREF="node144.html">7.24 Data selection based</A>
<B> Up:</B> <A NAME="tex2html4619"
  HREF="node120.html">7. Creating GMT Graphics</A>
<B> Previous:</B> <A NAME="tex2html4613"
  HREF="node142.html">7.22 World-wide seismicity the</A>
 &nbsp; <B>  <A NAME="tex2html4621"
  HREF="node1.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html4623"
  HREF="node255.html">Index</A></B> 
<BR>
<BR>
<!--End of Navigation Panel-->

<H1><A NAME="SECTION0015230000000000000000"></A>
<A NAME="sec:example_23"></A><A NAME="24078"></A>
<BR>
7.23 All great-circle paths lead to Rome
</H1>

<P>
While motorists recently have started to question the old saying ``all roads lead to Rome'',
aircraft pilots have known from the start that only one great-circle path connects the
points of departure and arrival<A NAME="tex2html1445"
  HREF="footnode.html#foot24079"><SUP>7.5</SUP></A>.  This provides the inspiration for our next
example which uses <A NAME="tex2html1447"
  HREF="../man/grdmath.html"><I><B>grdmath</B></I></A><A NAME="24997"></A> to calculate distances from Rome to anywhere on
Earth and <A NAME="tex2html1448"
  HREF="../man/grdcontour.html"><I><B>grdcontour</B></I></A><A NAME="25002"></A> to contour these distances.  We pick five cities that
we connect to Rome with great circle arcs, and label these cities with their names and
distances (in km) from Rome, all laid down on top of a beautiful world map.  Note that
we specify that contour labels only be placed along the straight map-line connecting
Rome to its antipode, and request curved labels that follows the shape of the contours.

<P>
<BR CLEAR="ALL">
<HR>
<BR>
<PRE>#!/bin/sh
#               GMT EXAMPLE 23
#
# Purpose:      Plot distances from Rome and draw shortest paths
# GMT progs:    grdmath, grdcontour, pscoast, psxy, pstext, grdtrack
# Unix progs:   echo, cat, awk
#
ps=example_23.ps

# Position and name of central point:

lon=12.50
lat=41.99
name="Rome"

# Calculate distances (km) to all points on a global 1x1 grid

grdmath -Rg -I1 $lon $lat SDIST 111.13 MUL = dist.grd

# Location info for 5 other cities + label justification

cat &lt;&lt; END &gt; cities.d
105.87  21.02   HANOI           LM
282.95  -12.1   LIMA            LM
178.42  -18.13  SUVA            LM
237.67  47.58   SEATTLE         RM
28.20   -25.75  PRETORIA        LM
END

pscoast -Rg -JH90/9i -Glightgreen -Sblue -U"Example 23 in Cookbook" -A1000 \
        -B0g30:."Distances from $name to the World": -K -Dc -Wthinnest &gt; $ps

grdcontour dist.grd -A1000+v+ukm+kwhite -Glz-/z+ -S8 -C500 -O -K -J \
        -Wathin,white -Wcthinnest,white,- &gt;&gt; $ps

# For each of the cities, plot great circle arc to Rome with psxy

while read clon clat city; do
        (echo $lon $lat; echo $clon $clat) | psxy -R -J -O -K -Wthickest/red &gt;&gt; $ps
done &lt; cities.d

# Plot red squares at cities and plot names:
psxy -R -J -O -K -Ss0.2 -Gred -Wthinnest cities.d &gt;&gt; $ps
awk '{print $1, $2, 12, 1, 9, $4, $3}' cities.d | pstext -R -J -O -K -Dj0.15/0 -Gred -N &gt;&gt; $ps
# Place a yellow star at Rome
echo "$lon $lat" | psxy -R -J -O -K -Sa0.2i -Gyellow -Wthin &gt;&gt; $ps

# Sample the distance grid at the cities and use the distance in km for labels

grdtrack -Gdist.grd cities.d \
        | awk '{printf "%s %s 12 0 1 CT %d\n", $1, $2, int($NF+0.5)}' \
        | pstext -R -J -O -D0/-0.2i -N -Wwhite,o -C0.02i/0.02i &gt;&gt; $ps

# Clean up after ourselves:

rm -f cities.d dist.grd .gmt*
</PRE>
<BR CLEAR="ALL">
<HR>
<DIV ALIGN="CENTER"><A NAME="fig:GMT_example_23"></A><A NAME="25008"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 7.23:</STRONG>
All great-circle paths lead to Rome.</CAPTION>
<TR><TD>
<DIV ALIGN="CENTER"><IMG
 WIDTH="518" HEIGHT="308" ALIGN="BOTTOM" BORDER="0"
 SRC="img191.png"
 ALT="\includegraphics[scale=0.5]{scripts/example_23}"></DIV></TD></TR>
</TABLE>
</DIV>

<P>
The script produces the plot in Figure&nbsp;<A HREF="#fig:GMT_example_23">7.23</A>; note how
interesting the path to Seattle appears in this particular projection (Hammer).
We also note that Rome's antipode lies somewhere near the Chatham plateau (antipodes
will be revisited in Section&nbsp;<A HREF="node145.html#sec:example_25">7.25</A>).

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

<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html4624"
  HREF="node144.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html4618"
  HREF="node120.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html4612"
  HREF="node142.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html4620"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html4622"
  HREF="node255.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html4625"
  HREF="node144.html">7.24 Data selection based</A>
<B> Up:</B> <A NAME="tex2html4619"
  HREF="node120.html">7. Creating GMT Graphics</A>
<B> Previous:</B> <A NAME="tex2html4613"
  HREF="node142.html">7.22 World-wide seismicity the</A>
 &nbsp; <B>  <A NAME="tex2html4621"
  HREF="node1.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html4623"
  HREF="node255.html">Index</A></B> 
<!--End of Navigation Panel-->
<ADDRESS>
Paul Wessel
2010-01-14
</ADDRESS>
</BODY>
</HTML>