Sophie

Sophie

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

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.27 Plotting Sandwell/Smith Mercator img grids</TITLE>
<META NAME="description" CONTENT="7.27 Plotting Sandwell/Smith Mercator img grids">
<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="node148.html">
<LINK REL="previous" HREF="node146.html">
<LINK REL="up" HREF="node120.html">
<LINK REL="next" HREF="node148.html">
</HEAD>

<BODY  bgcolor="#ffffff">
<!--Navigation Panel-->
<A NAME="tex2html4680"
  HREF="node148.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html4674"
  HREF="node120.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html4668"
  HREF="node146.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html4676"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html4678"
  HREF="node255.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html4681"
  HREF="node148.html">7.28 Mixing UTM and</A>
<B> Up:</B> <A NAME="tex2html4675"
  HREF="node120.html">7. Creating GMT Graphics</A>
<B> Previous:</B> <A NAME="tex2html4669"
  HREF="node146.html">7.26 General vertical perspective</A>
 &nbsp; <B>  <A NAME="tex2html4677"
  HREF="node1.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html4679"
  HREF="node255.html">Index</A></B> 
<BR>
<BR>
<!--End of Navigation Panel-->

<H1><A NAME="SECTION0015270000000000000000"></A>
<A NAME="24125"></A>
<BR>
7.27 Plotting Sandwell/Smith Mercator img grids
</H1>

<P>
Next, we show how to plot a data grid that is distributed in projected form.  The gravity and
predicted bathymetry grids produced by David Sandwell and Walter H. F. Smith are not geographical
grids but instead given on a spherical Mercator grid.  The <A NAME="tex2html1465"
  HREF="http://gmt.soest.hawaii.edu"><B>GMT</B></A> supplement imgsrc has tools to
extract subsets of these large grids.  If you need to make a non-Mercator map then you must extract
a geographic grid using <A NAME="tex2html1466"
  HREF="../man/img2grd.html"><I><B>img2grd</B></I></A><A NAME="25085"></A> and then plot it using your desired map projection.
However, if you want to make a Mercator map then you can save time and preserve data quality by
avoiding to re-project the data set twice since it is already in a Mercator projection.  This example
shows how this is accomplished.  We use the <B>-M</B> option in <A NAME="tex2html1467"
  HREF="../man/img2grd.html"><I><B>img2grd</B></I></A><A NAME="25091"></A><A NAME="tex2html1462"
  HREF="footnode.html#foot24177"><SUP>7.6</SUP></A> to pull out the
grid in Mercator units (i.e., do <I>not</I> invert the Mercator projection) and then simply plot the
grid using a linear projection with a suitable scale (here 0.25 inches per degrees of longitude).
To overlay basemaps and features that has geographic longitude/latitude coordinates we must remember
two key issues:

<OL>
<LI>This is a <I>spherical</I> Mercator grid so we must use <B>-ELLIPSOID</B>=Sphere with all
	commands that involve projections (or use <A NAME="tex2html1468"
  HREF="../man/gmtset.html"><I><B>gmtset</B></I></A><A NAME="25101"></A> to change the setting).
</LI>
<LI>Select Mercator projection and use the same scale that was used with the linear projection.
</LI>
</OL>

<P>
<BR CLEAR="ALL">
<HR>
<BR>
<PRE>#!/bin/sh
#               GMT EXAMPLE 27
#
# Purpose:      Illustrates how to plot Mercator img grids
# GMT progs:    makecpt, grdgradient, grdimage, grdinfo, pscoast
# GMT supplement: img2grd (to read Sandwell/Smith img files)
# Unix progs:   rm, grep, $AWK
#
ps=example_27.ps

# First extract a chunk of faa and retain short int precision to
# save disk space.  Gravity is thus in 0.1 mGal increments.
# Next get gradients.  The grid's region is in Mercator x/y units

#img2grd grav.15.2.img -R145/170/-50/-25 -M -C -T1 -Gtasman_grav.nc=ns
grdgradient tasman_grav.nc -Nt1 -A45 -Gtasman_grav_i.nc

# Make a suitable cpt file for mGal

makecpt -T-120/120/10 -Z -Crainbow &gt; grav.cpt

# Since this is a Mercator grid we use a linear projection

grdimage tasman_grav.nc=ns/0.1 -Itasman_grav_i.nc -Jx0.25i -Cgrav.cpt -P -K \
        -U"Example 27 in Cookbook" &gt; $ps

# Then use pscoast to plot land; get original -R from grid remark
# and use Mercator projection with same scale as above on a spherical Earth

R=`grdinfo tasman_grav.nc | grep Remark | awk '{print $NF}'`

pscoast $R -Jm0.25i -Ba10f5WSne -O -K -Gblack --ELLIPSOID=Sphere \
        -Cwhite -Dh+ --PLOT_DEGREE_FORMAT=dddF &gt;&gt; $ps

# Put a color legend on top of the land mask justified with 147E,31S

echo 147E 31S | mapproject -R -J --ELLIPSOID=Sphere &gt; tmp
echo 147E 31S 1 2.5 | psxy -R -J -O -K -Sr -D0.25i/0.05i -Gwhite -W1p --ELLIPSOID=Sphere &gt;&gt; $ps
pos=`$AWK '{printf "%si/%si\n", $1, $2}' tmp`
psscale -D$pos/2i/0.15i -Cgrav.cpt -B50f10/:mGal: -I -O &gt;&gt; $ps

# Clean up

rm -f grav.cpt *_i.nc .gmt* tmp
</PRE>
<BR CLEAR="ALL">
<HR>
<P>
This map of the Tasman Sea shows the marine gravity anomalies with land painted black.  A color scale bar
was then added to complete the illustration.

<P>

<DIV ALIGN="CENTER"><A NAME="fig:GMT_example_27"></A><A NAME="25107"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 7.27:</STRONG>
Plotting Sandwell/Smith Mercator img grids.</CAPTION>
<TR><TD>
<DIV ALIGN="CENTER"><IMG
 WIDTH="406" HEIGHT="484" ALIGN="BOTTOM" BORDER="0"
 SRC="img205.png"
 ALT="\includegraphics[scale=0.5]{scripts/example_27}"></DIV></TD></TR>
</TABLE>
</DIV>

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

<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html4680"
  HREF="node148.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html4674"
  HREF="node120.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html4668"
  HREF="node146.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html4676"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html4678"
  HREF="node255.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html4681"
  HREF="node148.html">7.28 Mixing UTM and</A>
<B> Up:</B> <A NAME="tex2html4675"
  HREF="node120.html">7. Creating GMT Graphics</A>
<B> Previous:</B> <A NAME="tex2html4669"
  HREF="node146.html">7.26 General vertical perspective</A>
 &nbsp; <B>  <A NAME="tex2html4677"
  HREF="node1.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html4679"
  HREF="node255.html">Index</A></B> 
<!--End of Navigation Panel-->
<ADDRESS>
Paul Wessel
2010-01-14
</ADDRESS>
</BODY>
</HTML>