Sophie

Sophie

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

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.29 Gridding spherical surface data using splines</TITLE>
<META NAME="description" CONTENT="7.29 Gridding spherical surface data using splines">
<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="node150.html">
<LINK REL="previous" HREF="node148.html">
<LINK REL="up" HREF="node120.html">
<LINK REL="next" HREF="node150.html">
</HEAD>

<BODY  bgcolor="#ffffff">
<!--Navigation Panel-->
<A NAME="tex2html4708"
  HREF="node150.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html4702"
  HREF="node120.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html4696"
  HREF="node148.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html4704"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html4706"
  HREF="node255.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html4709"
  HREF="node150.html">7.30 Trigonometric functions plotted</A>
<B> Up:</B> <A NAME="tex2html4703"
  HREF="node120.html">7. Creating GMT Graphics</A>
<B> Previous:</B> <A NAME="tex2html4697"
  HREF="node148.html">7.28 Mixing UTM and</A>
 &nbsp; <B>  <A NAME="tex2html4705"
  HREF="node1.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html4707"
  HREF="node255.html">Index</A></B> 
<BR>
<BR>
<!--End of Navigation Panel-->

<H1><A NAME="SECTION0015290000000000000000"></A>
<A NAME="24153"></A>
<BR>
7.29 Gridding spherical surface data using splines
</H1>

<P>
Next, we demonstrate how gridding on a spherical surface can be accomplished using Green's functions
of surface splines, with or without tension.  Global gridding does not work particularly well in
Cartesian coordinates hence the chosen approach.  We use <A NAME="tex2html1473"
  HREF="../man/greenspline.html"><I><B>greenspline</B></I></A><A NAME="25128"></A> to produce a crude
topography grid for Mars based on radii estimates from the Mariner 9 and Viking Orbiter spacecrafts.
This data comes from <I>Smith and Zuber</I> [Science, 1996] and is used here as a small (<I>N</I> = 370) data set we
can use to demonstrate spherical surface gridding.  Since <A NAME="tex2html1474"
  HREF="../man/greenspline.html"><I><B>greenspline</B></I></A><A NAME="25133"></A> must solve a <I>N</I> by <I>N</I>
matrix system your system memory may impose limits on how large data sets you can handle; also note that
the spherical surface spline in tension is particularly slow to compute.

<P>
<BR CLEAR="ALL">
<HR>
<BR>
<PRE>#!/bin/sh
#               GMT EXAMPLE 29
#
# Purpose:      Illustrates spherical surface gridding with Green's function of splines
# GMT progs:    makecpt, grdcontour, grdgradient, grdimage, grdmath greenspline, psscale, pstext
# Unix progs:   rm, echo
#
ps=example_29.ps

# This example uses 370 radio occultation data for Mars to grid the topography.
# Data and information from Smith, D. E., and M. T. Zuber (1996), The shape of
# Mars and the topographic signature of the hemispheric dichotomy, Science, 271, 184–187.

# Make Mars ellipsoid given their three best-fitting axes:
a=3399.472
b=3394.329
c=3376.502
grdmath -Rg -I4 -F X COSD $a DIV DUP MUL X SIND $b DIV DUP MUL ADD Y COSD DUP MUL MUL Y SIND $c DIV \
        DUP MUL ADD SQRT INV = ellipsoid.nc

#  Do both Parker and Wessel/Becker solutions (tension = 0.9975)
greenspline -Rellipsoid.nc mars370.in -D4 -Sp -Gmars.nc
greenspline -Rellipsoid.nc mars370.in -D4 -SQ0.9975/5001 -Gmars2.nc
# Scale to km and remove ellipsoid
grdmath mars.nc 1000 DIV ellipsoid.nc SUB = mars.nc
grdmath mars2.nc 1000 DIV ellipsoid.nc SUB = mars2.nc
makecpt -Crainbow -T-7/15/1 -Z &gt; mars.cpt
grdgradient mars2.nc -M -Ne0.75 -A45 -Gmars2_i.nc
grdimage mars2.nc -Imars2_i.nc -Cmars.cpt -B30g30Wsne -JH0/6i -P -K -Ei \
        -U"Example 29 in Cookbook" --ANNOT_FONT_SIZE_PRIMARY=12 &gt; $ps
grdcontour mars2.nc -J -O -K -C1 -A5 -Glz+/z- &gt;&gt; $ps
psxy -Rg -J -O -K -Sc0.045i -Gblack mars370.in  &gt;&gt; $ps
echo "0 90 14 0 1 LB b)" | pstext -R -J -O -K -N -D-3i/-0.2i &gt;&gt; $ps
grdgradient mars.nc -M -Ne0.75 -A45 -Gmars_i.nc
grdimage mars.nc -Imars_i.nc -Cmars.cpt -B30g30Wsne -J -O -K -Y3.6i -Ei --ANNOT_FONT_SIZE_PRIMARY=12 &gt;&gt; $ps
grdcontour mars.nc -J -O -K -C1 -A5 -Glz+/z- &gt;&gt; $ps
psxy -Rg -J -O -K -Sc0.045i -Gblack mars370.in  &gt;&gt; $ps
psscale -Cmars.cpt -O -K -D3i/-0.1i/5i/0.1ih -I --ANNOT_FONT_SIZE_PRIMARY=12 -B2f1/:km: &gt;&gt; $ps
echo "0 90 14 0 1 LB a)" | pstext -R -J -O -N -D-3i/-0.2i &gt;&gt; $ps
# Clean up
rm -f *.nc mars.cpt .gmt*
</PRE>
<BR CLEAR="ALL">
<HR>
<P>
Our script must first estimate the ellipsoidal shape of Mars from the parameters given by <I>Smith and Zuber</I>
so that we can remove this reference surface from the gridded radii.  We run the gridding twice: First with
no tension using <I>Parker</I>'s [1990] method and then with tension using the <I>Wessel and Becker</I> [2008] method.
The grids are then imaged with <A NAME="tex2html1475"
  HREF="../man/grdimage.html"><I><B>grdimage</B></I></A><A NAME="25139"></A> and <A NAME="tex2html1476"
  HREF="../man/grdcontour.html"><I><B>grdcontour</B></I></A><A NAME="25144"></A> and a color scale is placed between
them.

<P>

<DIV ALIGN="CENTER"><A NAME="fig:GMT_example_29"></A><A NAME="25149"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 7.29:</STRONG>
Gridding of spherical surface data using Green's function splines.</CAPTION>
<TR><TD>
<DIV ALIGN="CENTER"><IMG
 WIDTH="367" HEIGHT="381" ALIGN="BOTTOM" BORDER="0"
 SRC="img207.png"
 ALT="\includegraphics[scale=0.5]{scripts/example_29}"></DIV></TD></TR>
</TABLE>
</DIV>

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

<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html4708"
  HREF="node150.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html4702"
  HREF="node120.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html4696"
  HREF="node148.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html4704"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html4706"
  HREF="node255.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html4709"
  HREF="node150.html">7.30 Trigonometric functions plotted</A>
<B> Up:</B> <A NAME="tex2html4703"
  HREF="node120.html">7. Creating GMT Graphics</A>
<B> Previous:</B> <A NAME="tex2html4697"
  HREF="node148.html">7.28 Mixing UTM and</A>
 &nbsp; <B>  <A NAME="tex2html4705"
  HREF="node1.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html4707"
  HREF="node255.html">Index</A></B> 
<!--End of Navigation Panel-->
<ADDRESS>
Paul Wessel
2010-01-14
</ADDRESS>
</BODY>
</HTML>