Sophie

Sophie

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

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.14 Gridding of data and trend surfaces</TITLE>
<META NAME="description" CONTENT="7.14 Gridding of data and trend surfaces">
<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="node135.html">
<LINK REL="previous" HREF="node133.html">
<LINK REL="up" HREF="node120.html">
<LINK REL="next" HREF="node135.html">
</HEAD>

<BODY  bgcolor="#ffffff">
<!--Navigation Panel-->
<A NAME="tex2html4498"
  HREF="node135.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html4492"
  HREF="node120.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html4486"
  HREF="node133.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html4494"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html4496"
  HREF="node255.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html4499"
  HREF="node135.html">7.15 Gridding, contouring, and</A>
<B> Up:</B> <A NAME="tex2html4493"
  HREF="node120.html">7. Creating GMT Graphics</A>
<B> Previous:</B> <A NAME="tex2html4487"
  HREF="node133.html">7.13 Plotting of vector</A>
 &nbsp; <B>  <A NAME="tex2html4495"
  HREF="node1.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html4497"
  HREF="node255.html">Index</A></B> 
<BR>
<BR>
<!--End of Navigation Panel-->

<H1><A NAME="SECTION0015140000000000000000"></A>
<A NAME="23879"></A>
<BR>
7.14 Gridding of data and trend surfaces
</H1>

<P>
This example shows how one goes from randomly spaced data
points to an evenly sampled surface.  First we plot the
distribution and values of our raw data set (same as in
Section&nbsp;<A HREF="node132.html#sec:example_12">7.12</A>).  We choose an equidistant grid and run
<A NAME="tex2html1364"
  HREF="../man/blockmean.html"><I><B>blockmean</B></I></A><A NAME="24575"></A> which preprocesses the data to avoid aliasing.
The dashed lines indicate the logical blocks used by
<A NAME="tex2html1365"
  HREF="../man/blockmean.html"><I><B>blockmean</B></I></A><A NAME="24580"></A>; all points inside a given bin will be averaged.
The logical blocks are drawn from a temporary file we make on
the fly within the shell script.  The processed data is then
gridded with the <A NAME="tex2html1366"
  HREF="../man/surface.html"><I><B>surface</B></I></A><A NAME="24585"></A> program and contoured every 25
units.  A most important point here is that <A NAME="tex2html1367"
  HREF="../man/blockmean.html"><I><B>blockmean</B></I></A><A NAME="24590"></A>,
<A NAME="tex2html1368"
  HREF="../man/blockmedian.html"><I><B>blockmedian</B></I></A><A NAME="24595"></A>, or <A NAME="tex2html1369"
  HREF="../man/blockmode.html"><I><B>blockmode</B></I></A><A NAME="24600"></A> should always be run
prior to running <A NAME="tex2html1370"
  HREF="../man/surface.html"><I><B>surface</B></I></A><A NAME="24605"></A>, and both of these steps must use the same
grid interval.  We use <A NAME="tex2html1371"
  HREF="../man/grdtrend.html"><I><B>grdtrend</B></I></A><A NAME="24610"></A> to fit a bicubic trend
surface to the gridded data, contour it as well, and sample
both grid files along a diagonal transect using <A NAME="tex2html1372"
  HREF="../man/grdtrack.html"><I><B>grdtrack</B></I></A><A NAME="24615"></A>.
The bottom panel compares the gridded (solid line) and bicubic
trend (dashed line) along the transect using <A NAME="tex2html1373"
  HREF="../man/psxy.html"><I><B>psxy</B></I></A><A NAME="24620"></A>
(Figure&nbsp;<A HREF="#fig:GMT_example_14">7.14</A>):

<P>
<BR CLEAR="ALL">
<HR>
<BR>
<PRE>#!/bin/sh
#               GMT EXAMPLE 14
#
# Purpose:      Showing simple gridding, contouring, and resampling along tracks
# GMT progs:    blockmean, grdcontour, grdtrack, grdtrend, minmax, project
# GMT progs:    gmtset, pstext, psbasemap, psxy, surface
# Unix progs:   $AWK, rm
#
ps=example_14.ps

# First draw network and label the nodes

gmtset GRID_PEN_PRIMARY thinnest,-
psxy table_5.11 -R0/7/0/7 -JX3.06i/3.15i -B2f1WSNe -Sc0.05i -Gblack -P -K -Y6.45i &gt; $ps
$AWK '{printf "%g %s 6 0 0 LM %g\n", $1+0.08, $2, $3}' table_5.11 | pstext -R -J -O -K -N &gt;&gt; $ps
blockmean table_5.11 -R0/7/0/7 -I1 &gt; mean.xyz

# Then draw blockmean cells

psbasemap -R0.5/7.5/0.5/7.5 -J -O -K -B0g1 -X3.25i &gt;&gt; $ps
psxy -R0/7/0/7 -J -B2f1eSNw mean.xyz -Ss0.05i -Gblack -O -K &gt;&gt; $ps
$AWK '{printf "%g %s 6 0 0 LM %g\n", $1+0.1, $2, $3}' mean.xyz \
        | pstext -R -J -O -K -Wwhite,o -C0.01i/0.01i -N &gt;&gt; $ps

# Then surface and contour the data

surface mean.xyz -R -I1 -Gdata.grd
grdcontour data.grd -J -B2f1WSne -C25 -A50 -G3i/10 -S4 -O -K -X-3.25i -Y-3.55i &gt;&gt; $ps
psxy -R -J mean.xyz -Ss0.05i -Gblack -O -K &gt;&gt; $ps

# Fit bicubic trend to data and compare to gridded surface

grdtrend data.grd -N10 -Ttrend.grd
project -C0/0 -E7/7 -G0.1 &gt; track
grdcontour trend.grd -J -B2f1wSne -C25 -A50 -Glct/cb -S4 -O -K -X3.25i &gt;&gt; $ps
psxy -R -J track -Wthick,. -O -K &gt;&gt; $ps

# Sample along diagonal

grdtrack track -Gdata.grd | cut -f3,4 &gt; data.d
grdtrack track -Gtrend.grd | cut -f3,4 &gt; trend.d
psxy `minmax data.d trend.d -I0.5/25` -JX6.3i/1.4i data.d -Wthick -O -K -X-3.25i -Y-1.9i \
        -B1/50WSne &gt;&gt; $ps
psxy -R -J trend.d -Wthinner,- -O -U"Example 14 in Cookbook" &gt;&gt; $ps

rm -f mean.xyz track *.grd *.d .gmt*
</PRE>
<BR CLEAR="ALL">
<HR>
<DIV ALIGN="CENTER"><A NAME="fig:GMT_example_14"></A><A NAME="24626"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 7.14:</STRONG>
Gridding of data and trend surfaces.</CAPTION>
<TR><TD>
<DIV ALIGN="CENTER"><IMG
 WIDTH="481" HEIGHT="633" ALIGN="BOTTOM" BORDER="0"
 SRC="img173.png"
 ALT="\includegraphics[scale=0.6]{scripts/example_14}"></DIV></TD></TR>
</TABLE>
</DIV>

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

<P>
<HR>
<!--Navigation Panel-->
<A NAME="tex2html4498"
  HREF="node135.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> 
<A NAME="tex2html4492"
  HREF="node120.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> 
<A NAME="tex2html4486"
  HREF="node133.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> 
<A NAME="tex2html4494"
  HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> 
<A NAME="tex2html4496"
  HREF="node255.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> 
<BR>
<B> Next:</B> <A NAME="tex2html4499"
  HREF="node135.html">7.15 Gridding, contouring, and</A>
<B> Up:</B> <A NAME="tex2html4493"
  HREF="node120.html">7. Creating GMT Graphics</A>
<B> Previous:</B> <A NAME="tex2html4487"
  HREF="node133.html">7.13 Plotting of vector</A>
 &nbsp; <B>  <A NAME="tex2html4495"
  HREF="node1.html">Contents</A></B> 
 &nbsp; <B>  <A NAME="tex2html4497"
  HREF="node255.html">Index</A></B> 
<!--End of Navigation Panel-->
<ADDRESS>
Paul Wessel
2010-01-14
</ADDRESS>
</BODY>
</HTML>