1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<!--Converted with LaTeX2HTML 99.2beta8 (1.46)
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>3.2.1 Nearest neighbor gridding</TITLE>
<META NAME="description" CONTENT="3.2.1 Nearest neighbor gridding">
<META NAME="keywords" CONTENT="tutorial">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="LaTeX2HTML v99.2beta8">
<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
<LINK REL="STYLESHEET" HREF="tutorial.css">
<LINK REL="next" HREF="node64.html">
<LINK REL="previous" HREF="node61.html">
<LINK REL="up" HREF="node61.html">
<LINK REL="next" HREF="node63.html">
</HEAD>
<BODY bgcolor="#ffffff">
<!--Navigation Panel-->
<A NAME="tex2html1304"
HREF="node63.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.gif"></A>
<A NAME="tex2html1298"
HREF="node61.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.gif"></A>
<A NAME="tex2html1292"
HREF="node61.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.gif"></A>
<A NAME="tex2html1300"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.gif"></A>
<A NAME="tex2html1302"
HREF="node79.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.gif"></A>
<BR>
<B> Next:</B> <A NAME="tex2html1305"
HREF="node63.html">3.2.1.1 Exercises</A>
<B> Up:</B> <A NAME="tex2html1299"
HREF="node61.html">3.2 Gridding of arbitrarily</A>
<B> Previous:</B> <A NAME="tex2html1293"
HREF="node61.html">3.2 Gridding of arbitrarily</A>
  <B> <A NAME="tex2html1301"
HREF="node1.html">Contents</A></B>
  <B> <A NAME="tex2html1303"
HREF="node79.html">Index</A></B>
<BR>
<BR>
<!--End of Navigation Panel-->
<H2><A NAME="SECTION00521000000000000000">
3.2.1 Nearest neighbor gridding</A>
</H2>
<P>
<P></P>
<DIV ALIGN="CENTER"><A NAME="fig:GMT_nearneighbor"></A><A NAME="2945"></A>
<TABLE>
<CAPTION ALIGN="BOTTOM"><STRONG>Figure 3.1:</STRONG>
Search geometry for <A NAME="tex2html207"
HREF="../nearneighbor.html"><I><B>nearneighbor</B></I></A><A NAME="2951"></A></CAPTION>
<TR><TD><IMG
WIDTH="232" HEIGHT="232" BORDER="0"
SRC="img54.gif"
ALT="\begin{figure}\centering\epsfig{figure=eps/GMT_nearneighbor.eps}\end{figure}"></TD></TR>
</TABLE>
</DIV><P></P>
<P>
The <A NAME="tex2html213"
HREF="http://www.soest.hawaii.edu/gmt"><B>GMT</B></A> program <A NAME="tex2html214"
HREF="../nearneighbor.html"><I><B>nearneighbor</B></I></A><A NAME="2963"></A> implements a simple
``nearest neighbor'' averaging operation. It is the preferred
way to grid data when the data density is high. <A NAME="tex2html215"
HREF="../nearneighbor.html"><I><B>nearneighbor</B></I></A><A NAME="2972"></A>
is a local procedure which means it will only consider the control
data that is close to the desired output grid node.
Only data points inside a search radius will
be used, and we may also impose the condition that each of the <I>n</I>
sectors must have at least one data point in order to assign the nodal
value. The nodal value is computed as a weighted average of the nearest
data point per sector inside the search radius, with each point weighted
according to its distance from the node as follows:
<P>
<BR><P></P>
<DIV ALIGN="CENTER">
<!-- MATH
\begin{displaymath}
\bar{z} = \frac{\sum_{i=1}^{n} z_{i} w_{i}}{\sum_{i=1}^{n} w_{i}} \quad
w_{i} =
\left( 1 + \frac{9 r_{i}^{2}}{R^{2}} \right) ^{-1}
\end{displaymath}
-->
<IMG
WIDTH="224" HEIGHT="50" BORDER="0"
SRC="img55.gif"
ALT="\begin{displaymath}
\bar{z} = \frac{\sum_{i=1}^{n} z_{i} w_{i}}{\sum_{i=1}^{n} w...
...d
w_{i} =
\left( 1 + \frac{9 r_{i}^{2}}{R^{2}} \right) ^{-1} \end{displaymath}">
</DIV>
<BR CLEAR="ALL">
<P></P>
<P>
<A NAME="1255"></A>
<P>
The most important switches are listed in Table <A HREF="node62.html#tbl:nearneighbor">3.2</A>.
<P>
<BR><P></P>
<DIV ALIGN="CENTER"><A NAME="1745"></A>
<TABLE>
<CAPTION><STRONG>Table 3.2:</STRONG>
Switches used with the <A NAME="tex2html210"
HREF="../nearneighbor.html"><I><B>nearneighbor</B></I></A><A NAME="2985"></A> program</CAPTION>
<TR><TD>
<DIV ALIGN="CENTER"><TABLE CELLPADDING=3 BORDER="1">
<TR><TD ALIGN="CENTER" COLSPAN=1><FONT SIZE="-1">
<I>Option</I></FONT></TD>
<TD ALIGN="CENTER" COLSPAN=1><FONT SIZE="-1"> <I>Purpose</I></FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">
</FONT><FONT SIZE="-1"><B>-S</B></FONT><FONT SIZE="-1"><I>radius</I>[</FONT><FONT SIZE="-1"><B>k</B>] </FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1"> Sets search radius. Append </FONT><FONT SIZE="-1"><B>k</B> to indicate radius in kilometers [Default is </FONT><FONT SIZE="-1"><I>x</I>-units] </FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">
</FONT><FONT SIZE="-1"><B>-E</B></FONT><FONT SIZE="-1"><I>empty</I> </FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1"> Assign this value to unconstrained nodes [Default is NaN] </FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">
</FONT><FONT SIZE="-1"><B>-N</B></FONT><FONT SIZE="-1"><I>sectors</I> </FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1"> Sector search, indicate number of sectors [Default is 4] </FONT></TD>
</TR>
<TR><TD ALIGN="LEFT"><FONT SIZE="-1">
</FONT><FONT SIZE="-1"><B>-W</B> </FONT></TD>
<TD ALIGN="LEFT"><FONT SIZE="-1"> Read relative weights from the 4th column of input data </FONT></TD>
</TR>
</TABLE><FONT SIZE="-1">
<A NAME="tbl:nearneighbor"></A></FONT></DIV></TD></TR>
</TABLE>
</DIV><P></P>
<BR>
<P>
We will grid the data in the file <U>ship.xyz</U> which contains
ship observations of bathymetry off Baja California. We desire to
make a 5' by 5' grid. Running <A NAME="tex2html216"
HREF="../minmax.html"><I><B>minmax</B></I></A><A NAME="2995"></A> on the file yields
<P>
<PRE>
ship.xyz: N = 82970 <245/254.705> <20/29.99131> <-7708/-9>
</PRE>
<P>
so we choose the region accordingly:
<P>
<PRE>
nearneighbor -R245/255/20/30 -I5m -S40k -Gship.grd -V ship.xyz
</PRE>
<P>
We may get a view of the contour map using
<P>
<PRE>
grdcontour ship.grd -JM6i -P -B2 -C250 -A1000 | ghostview -
</PRE>
<P>
<BR><HR>
<!--Table of Child-Links-->
<A NAME="CHILD_LINKS"><STRONG>Subsections</STRONG></A>
<UL>
<LI><A NAME="tex2html1306"
HREF="node63.html">3.2.1.1 Exercises</A>
</UL>
<!--End of Table of Child-Links-->
<HR>
<!--Navigation Panel-->
<A NAME="tex2html1304"
HREF="node63.html">
<IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.gif"></A>
<A NAME="tex2html1298"
HREF="node61.html">
<IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.gif"></A>
<A NAME="tex2html1292"
HREF="node61.html">
<IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.gif"></A>
<A NAME="tex2html1300"
HREF="node1.html">
<IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.gif"></A>
<A NAME="tex2html1302"
HREF="node79.html">
<IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.gif"></A>
<BR>
<B> Next:</B> <A NAME="tex2html1305"
HREF="node63.html">3.2.1.1 Exercises</A>
<B> Up:</B> <A NAME="tex2html1299"
HREF="node61.html">3.2 Gridding of arbitrarily</A>
<B> Previous:</B> <A NAME="tex2html1293"
HREF="node61.html">3.2 Gridding of arbitrarily</A>
  <B> <A NAME="tex2html1301"
HREF="node1.html">Contents</A></B>
  <B> <A NAME="tex2html1303"
HREF="node79.html">Index</A></B>
<!--End of Navigation Panel-->
<ADDRESS>
Paul Wessel
2001-04-18
</ADDRESS>
</BODY>
</HTML>
|