<!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>3.2.3 Preprocessing</TITLE> <META NAME="description" CONTENT="3.2.3 Preprocessing"> <META NAME="keywords" CONTENT="GMT_Tutorial"> <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_Tutorial.css"> <LINK REL="previous" HREF="node46.html"> <LINK REL="up" HREF="node43.html"> <LINK REL="next" HREF="node48.html"> </HEAD> <BODY bgcolor="#ffffff"> <!--Navigation Panel--> <A NAME="tex2html1059" HREF="node48.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html1053" HREF="node43.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html1049" HREF="node46.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html1055" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html1057" HREF="node63.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html1060" HREF="node48.html">3.3 Exercises</A> <B> Up:</B> <A NAME="tex2html1054" HREF="node43.html">3.2 Gridding of arbitrarily</A> <B> Previous:</B> <A NAME="tex2html1050" HREF="node46.html">3.2.2 Gridding with Splines</A> <B> <A NAME="tex2html1056" HREF="node1.html">Contents</A></B> <B> <A NAME="tex2html1058" HREF="node63.html">Index</A></B> <BR> <BR> <!--End of Navigation Panel--> <H2><A NAME="SECTION00523000000000000000"> 3.2.3 Preprocessing</A> </H2> <P> The <A NAME="tex2html190" HREF="../man/surface.html"><I><B>surface</B></I></A><A NAME="2405"></A> program assumes that the data have been preprocessed to eliminate aliasing, hence we must ensure that this step is completed prior to gridding. <A NAME="tex2html191" HREF="http://gmt.soest.hawaii.edu"><B>GMT</B></A> comes with three preprocessors, called <A NAME="tex2html192" HREF="../man/blockmean.html"><I><B>blockmean</B></I></A><A NAME="2413"></A>, <A NAME="tex2html193" HREF="../man/blockmedian.html"><I><B>blockmedian</B></I></A><A NAME="2418"></A>, and <A NAME="tex2html194" HREF="../man/blockmode.html"><I><B>blockmode</B></I></A><A NAME="2423"></A>. The first averages values inside the grid-spacing boxes, the second returns median values, wile the latter returns modal values. As a rule of thumb, we use means for most smooth data (such as potential fields) and medians (or modes) for rough, non-Gaussian data (such as topography). In addition to the required <B>-R</B> and <B>-I</B> switches, these preprocessors all take the same options (listed in Table <A HREF="#tbl:preprocess">3.4</A>). <P> <BR><P></P> <DIV ALIGN="CENTER"><A NAME="1253"></A> <TABLE> <CAPTION><STRONG>Table 3.4:</STRONG> Some of the preprocessing options.</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><TH ALIGN="LEFT"><FONT SIZE="-1"> <B>-N</B> </FONT></TH> <TD ALIGN="LEFT"><FONT SIZE="-1"> Choose pixel node registration [Default is gridline] </FONT></TD> </TR> <TR><TH ALIGN="LEFT"><FONT SIZE="-1"> <B>-W</B>[</FONT><FONT SIZE="-1"><B>i</B><IMG WIDTH="8" HEIGHT="31" ALIGN="MIDDLE" BORDER="0" SRC="img1.png" ALT="$\vert$"></FONT><FONT SIZE="-1"><B>o</B>] </FONT></TH> <TD ALIGN="LEFT"><FONT SIZE="-1"> Append </FONT><FONT SIZE="-1"><B>i</B> or </FONT><FONT SIZE="-1"><B>o</B> to read or write weights in the 4th column </FONT></TD> </TR> </TABLE><FONT SIZE="-1"> <A NAME="tbl:preprocess"></A></FONT></DIV></TD></TR> </TABLE> </DIV><P></P> <BR> <P> With respect to our ship data we preprocess it using the median method: <P> <PRE> blockmedian -R245/255/20/30 -I5m -V ship.xyz > ship_5m.xyz </PRE> <P> The output data can now be used with surface: <P> <PRE> surface ship_5m.xyz -R245/255/20/30 -I5m -Gship.nc -V </PRE> <P> If you rerun <A NAME="tex2html195" HREF="../man/grdcontour.html"><I><B>grdcontour</B></I></A><A NAME="2432"></A> on the new grid file (try it!) you will notice a big difference compared to the grid made by <A NAME="tex2html196" HREF="../man/nearneighbor.html"><I><B>nearneighbor</B></I></A><A NAME="2437"></A>: since <A NAME="tex2html197" HREF="../man/surface.html"><I><B>surface</B></I></A><A NAME="2442"></A> is a global method it will evaluate the solution at all nodes, even if there are no data constraints. There are numerous options available to us at this point: <P> <OL> <LI>We can reset all nodes too far from a data constraint to the NaN value. <P> </LI> <LI>We can pour white paint over those regions where contours are unreliable. <P> </LI> <LI>We can plot the landmass which will cover most (but not all) of the unconstrained areas. <P> </LI> <LI>We can set up a clip path so that only the contours in the constrained region will show. <P> </LI> </OL> <P> Here we have only time to explore the latter approach. The <A NAME="tex2html198" HREF="../man/psmask.html"><I><B>psmask</B></I></A><A NAME="2447"></A> program can read the same preprocessed data and set up a contour mask based on the data distribution. Once the clip path is activated we can contour the final grid; we finally deactivate the clipping with a second call to <A NAME="tex2html199" HREF="../man/psmask.html"><I><B>psmask</B></I></A><A NAME="2452"></A>. Here's the recipe: <P> <PRE> psmask -R245/255/20/30 -I5m ship_5m.xyz -JM6i -B2 -P -K -V > map.ps grdcontour ship.nc -J -O -K -C250 -A1000 >> map.ps psmask -C -O >> map.ps </PRE> <P> <HR> <!--Navigation Panel--> <A NAME="tex2html1059" HREF="node48.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html1053" HREF="node43.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html1049" HREF="node46.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html1055" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html1057" HREF="node63.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html1060" HREF="node48.html">3.3 Exercises</A> <B> Up:</B> <A NAME="tex2html1054" HREF="node43.html">3.2 Gridding of arbitrarily</A> <B> Previous:</B> <A NAME="tex2html1050" HREF="node46.html">3.2.2 Gridding with Splines</A> <B> <A NAME="tex2html1056" HREF="node1.html">Contents</A></B> <B> <A NAME="tex2html1058" HREF="node63.html">Index</A></B> <!--End of Navigation Panel--> <ADDRESS> Paul Wessel 2010-07-14 </ADDRESS> </BODY> </HTML>