Sophie

Sophie

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

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.16 Gridding of data, continued</TITLE>
<META NAME="description" CONTENT="7.16 Gridding of data, continued">
<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="node137.html">
<LINK REL="previous" HREF="node135.html">
<LINK REL="up" HREF="node120.html">
<LINK REL="next" HREF="node137.html">
</HEAD>

<BODY  bgcolor="#ffffff">
<!--Navigation Panel-->
<A NAME="tex2html4526"
  HREF="node137.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html4520"
  HREF="node120.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html4514"
  HREF="node135.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html4522"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html4524"
  HREF="node255.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html4527"
  HREF="node137.html">7.17 Images clipped by</A>
<B> Up:</B> <A NAME="tex2html4521"
  HREF="node120.html">7. Creating GMT Graphics</A>
<B> Previous:</B> <A NAME="tex2html4515"
  HREF="node135.html">7.15 Gridding, contouring, and</A>
 &nbsp; <B>  <A NAME="tex2html4523"
  HREF="node1.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html4525"
  HREF="node255.html">Index</A></B> 
<BR>
<BR>
<!--End of Navigation Panel-->

<H1><A NAME="SECTION0015160000000000000000"></A>
<A NAME="23913"></A>
<BR>
7.16 Gridding of data, continued
</H1>

<P>
<A NAME="tex2html1385"
  HREF="../man/pscontour.html"><I><B>pscontour</B></I></A><A NAME="24680"></A> (for contouring) and <A NAME="tex2html1386"
  HREF="../man/triangulate.html"><I><B>triangulate</B></I></A><A NAME="24685"></A>
(for gridding) use the simplest method of interpolating
data:  a Delaunay triangulation (see Section&nbsp;<A HREF="node132.html#sec:example_12">7.12</A>) which
forms <IMG
 WIDTH="43" HEIGHT="31" ALIGN="MIDDLE" BORDER="0"
 SRC="img175.png"
 ALT="$z(x, y)$"> as a union of planar triangular facets.
One advantage of this method is that it will not extrapolate
<IMG
 WIDTH="43" HEIGHT="31" ALIGN="MIDDLE" BORDER="0"
 SRC="img175.png"
 ALT="$z(x, y)$"> beyond the convex hull of the input (<I>x, y</I>)
data.  Another is that it will not estimate a <I>z</I> value
above or below the local bounds on any triangle.
A disadvantage is that the <IMG
 WIDTH="43" HEIGHT="31" ALIGN="MIDDLE" BORDER="0"
 SRC="img175.png"
 ALT="$z(x, y)$"> surface is not
differentiable, but has sharp kinks at triangle edges and
thus also along contours.  This may not look physically
reasonable, but it can be filtered later (last panel below).
<A NAME="tex2html1387"
  HREF="../man/surface.html"><I><B>surface</B></I></A><A NAME="24690"></A> can be used to generate a higher-order
(smooth and differentiable) interpolation of <IMG
 WIDTH="43" HEIGHT="31" ALIGN="MIDDLE" BORDER="0"
 SRC="img175.png"
 ALT="$z(x, y)$"> onto
a grid, after which the grid may be illustrated (<A NAME="tex2html1388"
  HREF="../man/grdcontour.html"><I><B>grdcontour</B></I></A><A NAME="24695"></A>,
<A NAME="tex2html1389"
  HREF="../man/grdimage.html"><I><B>grdimage</B></I></A><A NAME="24700"></A>, <A NAME="tex2html1390"
  HREF="../man/grdview.html"><I><B>grdview</B></I></A><A NAME="24705"></A>).  <A NAME="tex2html1391"
  HREF="../man/surface.html"><I><B>surface</B></I></A><A NAME="24710"></A> will interpolate
to all (<I>x, y</I>) points in a rectangular region, and thus
will extrapolate beyond the convex hull of the data.  However,
this can be masked out in various ways (see Section&nbsp;<A HREF="node135.html#sec:example_15">7.15</A>).

<P>
A more serious objection is that <A NAME="tex2html1392"
  HREF="../man/surface.html"><I><B>surface</B></I></A><A NAME="24715"></A> may estimate
<I>z</I> values outside the local range of the data (note area
near <I>x</I> = 0.8, <I>y</I> = 5.3).  This commonly happens when
the default tension value of zero is used to create a ``minimum
curvature'' (most smooth) interpolant.  <A NAME="tex2html1393"
  HREF="../man/surface.html"><I><B>surface</B></I></A><A NAME="24720"></A> can be
used with non-zero tension to partially  overcome this problem.
The limiting value <IMG
 WIDTH="78" HEIGHT="29" ALIGN="MIDDLE" BORDER="0"
 SRC="img176.png"
 ALT="$tension = 1$"> should approximate the triangulation,
while a value between 0 and 1 may yield a good compromise between
the above two cases.  A value of 0.5 is shown here
(Figure&nbsp;<A HREF="#fig:GMT_example_16">7.16</A>).  A side
effect of the tension is that it tends to make the contours turn
near the edges of the domain so that they approach the edge from
a perpendicular direction.  A solution is to use <A NAME="tex2html1394"
  HREF="../man/surface.html"><I><B>surface</B></I></A><A NAME="24725"></A>
in a larger area and then use <A NAME="tex2html1395"
  HREF="../man/grdcut.html"><I><B>grdcut</B></I></A><A NAME="24730"></A> to cut out the desired
smaller area.  Another way to achieve a compromise is to
interpolate the data to a grid and then filter the grid using
<A NAME="tex2html1396"
  HREF="../man/grdfft.html"><I><B>grdfft</B></I></A><A NAME="24735"></A> or <A NAME="tex2html1397"
  HREF="../man/grdfilter.html"><I><B>grdfilter</B></I></A><A NAME="24740"></A>.  The latter can handle grids
containing ``NaN'' values and it can do  median and mode filters
as well as convolutions.  Shown here is <A NAME="tex2html1398"
  HREF="../man/triangulate.html"><I><B>triangulate</B></I></A><A NAME="24745"></A> followed
by <A NAME="tex2html1399"
  HREF="../man/grdfilter.html"><I><B>grdfilter</B></I></A><A NAME="24750"></A>.  Note that the filter has done some
extrapolation beyond the convex hull of the original <I>x, y</I>
values.  The ``best'' smooth approximation of <IMG
 WIDTH="43" HEIGHT="31" ALIGN="MIDDLE" BORDER="0"
 SRC="img175.png"
 ALT="$z(x, y)$"> depends
on the errors in the data and the physical laws obeyed by <I>z</I>.
<A NAME="tex2html1400"
  HREF="http://gmt.soest.hawaii.edu"><B>GMT</B></A> cannot always do the ``best'' thing but it offers great
flexibility through its combinations of tools.  We illustrate all
four solutions using a cpt file that contains color fills,
predefined patterns for interval (900,925) and NaN, an image pattern for interval (875,900),
and a ``skip slice'' request for interval (700,725).

<P>
<BR CLEAR="ALL">
<HR>
<BR>
<PRE>#!/bin/sh
#               GMT EXAMPLE 16
#
# Purpose:      Illustrates interpolation methods using same data as Example 12.
# GMT progs:    gmtset, grdview, grdfilter, pscontour, psscale, pstext, surface, triangulate
# Unix progs:   echo, rm
#
# Illustrate various means of contouring, using triangulate and surface.
#
ps=example_16.ps
gmtset ANNOT_FONT_SIZE_PRIMARY 9
#
pscontour -R0/6.5/-0.2/6.5 -Jx0.45i -P -K -Y5.5i -Ba2f1WSne table_5.11 -Cex16.cpt -I &gt; $ps
echo "3.25 7 18 0 4 CB pscontour (triangulate)" | pstext -R -J -O -K -N &gt;&gt; $ps
#
surface table_5.11 -R -I0.2 -Graws0.grd
grdview raws0.grd -R -J -Ba2f1WSne -Cex16.cpt -Qs -O -K -X3.5i &gt;&gt; $ps
echo "3.25 7 18 0 4 CB surface (tension = 0)" | pstext -R -J -O -K -N &gt;&gt; $ps
#
surface table_5.11 -R -I0.2 -Graws5.grd -T0.5
grdview raws5.grd -R -J -Ba2f1WSne -Cex16.cpt -Qs -O -K -Y-3.75i -X-3.5i &gt;&gt; $ps
echo "3.25 7 18 0 4 CB surface (tension = 0.5)" | pstext -R -J -O -K -N &gt;&gt; $ps
#
triangulate table_5.11 -Grawt.grd -R -I0.2 &gt; /dev/null
grdfilter rawt.grd -Gfiltered.grd -D0 -Fc1
grdview filtered.grd -R -J -Ba2f1WSne -Cex16.cpt -Qs -O -K -X3.5i &gt;&gt; $ps
echo "3.25 7 18 0 4 CB triangulate @~\256@~ grdfilter" | pstext -R -J -O -K -N &gt;&gt; $ps
echo "3.2125 7.5 32 0 4 CB Gridding of Data" | pstext -R0/10/0/10 -Jx1i -O -K -N -X-3.5i &gt;&gt; $ps
psscale -D3.25i/0.35i/5i/0.25ih -Cex16.cpt -O -U"Example 16 in Cookbook" -Y-0.75i &gt;&gt; $ps
#
rm -f *.grd .gmt*
</PRE>
<BR CLEAR="ALL">
<HR>
<DIV ALIGN="CENTER"><A NAME="fig:GMT_example_16"></A><A NAME="24759"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 7.16:</STRONG>
More ways to grid data.</CAPTION>
<TR><TD>
<DIV ALIGN="CENTER"><IMG
 WIDTH="463" HEIGHT="600" ALIGN="BOTTOM" BORDER="0"
 SRC="img177.png"
 ALT="\includegraphics[scale=0.6]{scripts/example_16}"></DIV></TD></TR>
</TABLE>
</DIV>

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

<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html4526"
  HREF="node137.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html4520"
  HREF="node120.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html4514"
  HREF="node135.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html4522"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html4524"
  HREF="node255.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html4527"
  HREF="node137.html">7.17 Images clipped by</A>
<B> Up:</B> <A NAME="tex2html4521"
  HREF="node120.html">7. Creating GMT Graphics</A>
<B> Previous:</B> <A NAME="tex2html4515"
  HREF="node135.html">7.15 Gridding, contouring, and</A>
 &nbsp; <B>  <A NAME="tex2html4523"
  HREF="node1.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html4525"
  HREF="node255.html">Index</A></B> 
<!--End of Navigation Panel-->
<ADDRESS>
Paul Wessel
2010-01-14
</ADDRESS>
</BODY>
</HTML>