<!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.12 Optimal triangulation of data</TITLE> <META NAME="description" CONTENT="7.12 Optimal triangulation of data"> <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="node134.html"> <LINK REL="previous" HREF="node132.html"> <LINK REL="up" HREF="node121.html"> <LINK REL="next" HREF="node134.html"> </HEAD> <BODY bgcolor="#ffffff"> <!--Navigation Panel--> <A NAME="tex2html4518" HREF="node134.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html4512" HREF="node121.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html4506" HREF="node132.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html4514" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html4516" HREF="node256.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html4519" HREF="node134.html">7.13 Plotting of vector</A> <B> Up:</B> <A NAME="tex2html4513" HREF="node121.html">7. Creating GMT Graphics</A> <B> Previous:</B> <A NAME="tex2html4507" HREF="node132.html">7.11 Making a 3-D</A> <B> <A NAME="tex2html4515" HREF="node1.html">Contents</A></B> <B> <A NAME="tex2html4517" HREF="node256.html">Index</A></B> <BR> <BR> <!--End of Navigation Panel--> <H1><A NAME="SECTION0015120000000000000000"></A> <A NAME="sec:example_12"></A><A NAME="24442"></A> <BR> 7.12 Optimal triangulation of data </H1> <P> Our next example (Figure <A HREF="#fig:GMT_example_12">7.12</A>) operates on a data set of topographic readings non-uniformly distributed in the plane (Table 5.11 in Davis: <I>Statistics and Data Analysis in Geology</I>, J. Wiley). We use <A NAME="tex2html1382" HREF="../man/triangulate.html"><I><B>triangulate</B></I></A><A NAME="25110"></A> to perform the optimal Delaunay triangulation, then use the output to draw the resulting network. We label the node numbers as well as the node values, and call <A NAME="tex2html1383" HREF="../man/pscontour.html"><I><B>pscontour</B></I></A><A NAME="25115"></A> to make a contour map and image directly from the raw data. Thus, in this example we do not actually make grid files but still are able to contour and image the data. We use a color palette table <U>topo.cpt</U> (created via <A NAME="tex2html1384" HREF="../man/minmax.html"><I><B>minmax</B></I></A><A NAME="25121"></A> and <A NAME="tex2html1385" HREF="../man/makecpt.html"><I><B>makecpt</B></I></A><A NAME="25126"></A>). The script becomes: <P> <BR CLEAR="ALL"> <HR> <BR> <PRE>#!/bin/sh # GMT EXAMPLE 12 # # Purpose: Illustrates Delaunay triangulation of points, and contouring # GMT progs: makecpt, minmax, pscontour, pstext, psxy, triangulate # Unix progs: $AWK, echo, rm # # First draw network and label the nodes # ps=example_12.ps triangulate table_5.11 -m > net.xy psxy -R0/6.5/-0.2/6.5 -JX3.06i/3.15i -B2f1WSNe -m net.xy -Wthinner -P -K -X0.9i -Y4.65i > $ps psxy table_5.11 -R -J -O -K -Sc0.12i -Gwhite -Wthinnest >> $ps $AWK '{print $1, $2, 6, 0, 0, "CM", NR-1}' table_5.11 | pstext -R -J -O -K >> $ps # # Then draw network and print the node values # psxy -R -J -B2f1eSNw -m net.xy -Wthinner -O -K -X3.25i >> $ps psxy -R -J -O -K table_5.11 -Sc0.03i -Gblack >> $ps $AWK '{printf "%g %s 6 0 0 LM %g\n", $1, $2, $3}' table_5.11 | pstext -R -J -O -K -Wwhite,o \ -C0.01i/0.01i -D0.08i/0i -N >> $ps # # Then contour the data and draw triangles using dashed pen; use "minmax" and "makecpt" to make a # color palette (.cpt) file # T=`minmax -T25/2 table_5.11` makecpt -Cjet $T > topo.cpt pscontour -R -J table_5.11 -B2f1WSne -Wthin -Ctopo.cpt -Lthinnest,- -G1i/0 -X-3.25i -Y-3.65i -O -K \ -U"Example 12 in Cookbook" >> $ps # # Finally color the topography # pscontour -R -J table_5.11 -B2f1eSnw -Ctopo.cpt -I -X3.25i -O -K >> $ps echo "3.16 8 30 0 1 BC Delaunay Triangulation" | \ pstext -R0/8/0/11 -Jx1i -O -X-3.25i >> $ps # rm -f net.xy topo.cpt .gmt* </PRE> <BR CLEAR="ALL"> <HR> <DIV ALIGN="CENTER"><A NAME="fig:GMT_example_12"></A><A NAME="25132"></A> <TABLE> <CAPTION ALIGN="BOTTOM"><STRONG>Figure 7.12:</STRONG> Optimal triangulation of data.</CAPTION> <TR><TD> <DIV ALIGN="CENTER"><IMG WIDTH="385" HEIGHT="493" ALIGN="BOTTOM" BORDER="0" SRC="img169.png" ALT="\includegraphics[scale=0.5]{scripts/example_12}"></DIV></TD></TR> </TABLE> </DIV> <P> <A NAME="24453"></A> <P> <HR> <!--Navigation Panel--> <A NAME="tex2html4518" HREF="node134.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html4512" HREF="node121.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html4506" HREF="node132.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html4514" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html4516" HREF="node256.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html4519" HREF="node134.html">7.13 Plotting of vector</A> <B> Up:</B> <A NAME="tex2html4513" HREF="node121.html">7. Creating GMT Graphics</A> <B> Previous:</B> <A NAME="tex2html4507" HREF="node132.html">7.11 Making a 3-D</A> <B> <A NAME="tex2html4515" HREF="node1.html">Contents</A></B> <B> <A NAME="tex2html4517" HREF="node256.html">Index</A></B> <!--End of Navigation Panel--> <ADDRESS> Paul Wessel 2010-07-14 </ADDRESS> </BODY> </HTML>