Sophie

Sophie

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

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.22 World-wide seismicity the last 7 days</TITLE>
<META NAME="description" CONTENT="7.22 World-wide seismicity the last 7 days">
<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="node143.html">
<LINK REL="previous" HREF="node141.html">
<LINK REL="up" HREF="node120.html">
<LINK REL="next" HREF="node143.html">
</HEAD>

<BODY  bgcolor="#ffffff">
<!--Navigation Panel-->
<A NAME="tex2html4610"
  HREF="node143.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html4604"
  HREF="node120.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html4598"
  HREF="node141.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html4606"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html4608"
  HREF="node255.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html4611"
  HREF="node143.html">7.23 All great-circle paths</A>
<B> Up:</B> <A NAME="tex2html4605"
  HREF="node120.html">7. Creating GMT Graphics</A>
<B> Previous:</B> <A NAME="tex2html4599"
  HREF="node141.html">7.21 Time-series of RedHat</A>
 &nbsp; <B>  <A NAME="tex2html4607"
  HREF="node1.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html4609"
  HREF="node255.html">Index</A></B> 
<BR>
<BR>
<!--End of Navigation Panel-->

<H1><A NAME="SECTION0015220000000000000000"></A>
<A NAME="24064"></A>
<BR>
7.22 World-wide seismicity the last 7 days
</H1>

<P>
The next example uses the command-line tool <I>wget</I><A NAME="24972"></A> to obtain a data file
from a specified URL<A NAME="tex2html1442"
  HREF="footnode.html#foot24176"><SUP>7.4</SUP></A>.
In the example script this line is commented out so the
example will run even if you do not have <I>wget</I><A NAME="24978"></A> (we use the supplied
<U>neic_quakes.d</U> which normally would be created by <I>wget</I><A NAME="24982"></A>); remove the comment to
get the actual current seismicity plot using the live data.  The main purpose of
this script is not to show how to plot a map background and a few circles, but
rather demonstrate how a map legend may be composed using the new tool <A NAME="tex2html1444"
  HREF="../man/pslegend.html"><I><B>pslegend</B></I></A><A NAME="24986"></A>.
Some scripting is used to pull out information from the data file that is later
used in the legend.  The legend will normally have the email address of the script
owner; here that command is commented out and the user is hardwired to ``GMT guru''.
The USGS logo, taken from their web page and converted to a Sun raster file, is used
to spice up the legend.

<P>
<BR CLEAR="ALL">
<HR>
<BR>
<PRE>#!/bin/sh
#               GMT EXAMPLE 22
#
# Purpose:      Automatic map of last 7 days of world-wide seismicity
# GMT progs:    gmtset, pscoast, psxy, pslegend
# Unix progs:   cat, sed, awk, wget|curl
#
ps=example_22.ps
gmtset ANNOT_FONT_SIZE_PRIMARY 10p HEADER_FONT_SIZE 18p PLOT_DEGREE_FORMAT ddd:mm:ssF

# Get the data (-q quietly) from USGS using the wget (comment out in case
# your system does not have wget or curl)

#wget http://neic.usgs.gov/neis/gis/bulletin.asc -q -O neic_quakes.d
#curl http://neic.usgs.gov/neis/gis/bulletin.asc -s &gt; neic_quakes.d

# Count the number of events (to be used in title later. one less due to header)

n=`cat neic_quakes.d | wc -l`
n=`expr $n - 1`

# Pull out the first and last timestamp to use in legend title

first=`sed -n 2p neic_quakes.d | awk -F, '{printf "%s %s\n", $1, $2}'`
last=`sed -n '$p' neic_quakes.d | awk -F, '{printf "%s %s\n", $1, $2}'`

# Assign a string that contains the current user @ the current computer node.
# Note that two @@ is needed to print a single @ in pstext:

#set me = "$user@@`hostname`"
me="GMT guru @@ GMTbox"

# Create standard seismicity color table

cat &gt; neis.cpt &lt;&lt; END
0       red     100     red
100     green   300     green
300     blue    10000   blue
END

# Start plotting. First lay down map, then plot quakes with size = magintude/50":

pscoast -Rg -JK180/9i -B45g30:."World-wide earthquake activity": -Gbrown -Slightblue \
        -Dc -A1000 -K -U/-0.75i/-2.5i/"Example 22 in Cookbook" -Y2.75i &gt; $ps
awk -F, '{ print $4, $3, $6, $5*0.02}' neic_quakes.d \
        | psxy -R -JK -O -K -Cneis.cpt -Sci -Wthin -H &gt;&gt; $ps
# Create legend input file for NEIS quake plot

cat &gt; neis.legend &lt;&lt; END
H 16 1 $n events during $first to $last
D 0 1p
N 3
V 0 1p
S 0.1i c 0.1i red 0.25p 0.2i Shallow depth (0-100 km)
S 0.1i c 0.1i green 0.25p 0.2i Intermediate depth (100-300 km)
S 0.1i c 0.1i blue 0.25p 0.2i Very deep (&gt; 300 km)
V 0 1p
D 0 1p
N 7
V 0 1p
S 0.1i c 0.06i - 0.25p 0.3i M 3
S 0.1i c 0.08i - 0.25p 0.3i M 4
S 0.1i c 0.10i - 0.25p 0.3i M 5
S 0.1i c 0.12i - 0.25p 0.3i M 6
S 0.1i c 0.14i - 0.25p 0.3i M 7
S 0.1i c 0.16i - 0.25p 0.3i M 8
S 0.1i c 0.18i - 0.25p 0.3i M 9
V 0 1p
D 0 1p
N 1
&gt;
END

# Put together a reasonable legend text, and add logo and user's name:

cat &lt;&lt; END &gt;&gt; neis.legend
&gt;
T USGS/NEIS most recent earthquakes for the last seven days.  The data were
T obtained automatically from the USGS Earthquake Hazards Program page at
T @_http://neic/usgs.gov @_.  Interested users may also receive email alerts
T from the USGS.
T This script can be called daily to update the latest information.
G 0.4i
# Add USGS logo
I USGS.ras 1i RT
G -0.3i
L 12 6 LB $me
END

# OK, now we can actually run pslegend.  We center the legend below the map.
# Trial and error shows that 1.7i is a good legend height:

pslegend -Dx4.5i/-0.4i/7i/1.7i/TC -J -R -O -F neis.legend -Glightyellow &gt;&gt; $ps

# Clean up after ourselves:

rm -f neis.* .gmt*
</PRE>
<BR CLEAR="ALL">
<HR>
<DIV ALIGN="CENTER"><A NAME="fig:GMT_example_22"></A><A NAME="24992"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 7.22:</STRONG>
World-wide seismicity the last 7 days.</CAPTION>
<TR><TD>
<DIV ALIGN="CENTER"><IMG
 WIDTH="549" HEIGHT="415" ALIGN="BOTTOM" BORDER="0"
 SRC="img190.png"
 ALT="\includegraphics[scale=0.5]{scripts/example_22}"></DIV></TD></TR>
</TABLE>
</DIV>

<P>
The script produces the plot in Figure&nbsp;<A HREF="#fig:GMT_example_22">7.22</A>, giving the URL
where these and similar data can be obtained.

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

<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html4610"
  HREF="node143.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html4604"
  HREF="node120.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html4598"
  HREF="node141.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html4606"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html4608"
  HREF="node255.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html4611"
  HREF="node143.html">7.23 All great-circle paths</A>
<B> Up:</B> <A NAME="tex2html4605"
  HREF="node120.html">7. Creating GMT Graphics</A>
<B> Previous:</B> <A NAME="tex2html4599"
  HREF="node141.html">7.21 Time-series of RedHat</A>
 &nbsp; <B>  <A NAME="tex2html4607"
  HREF="node1.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html4609"
  HREF="node255.html">Index</A></B> 
<!--End of Navigation Panel-->
<ADDRESS>
Paul Wessel
2010-01-14
</ADDRESS>
</BODY>
</HTML>