<!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.15 Gridding, contouring, and masking of unconstrained areas</TITLE> <META NAME="description" CONTENT="7.15 Gridding, contouring, and masking of unconstrained areas"> <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="node121.html"> <LINK REL="next" HREF="node137.html"> </HEAD> <BODY bgcolor="#ffffff"> <!--Navigation Panel--> <A NAME="tex2html4560" HREF="node137.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html4554" HREF="node121.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html4548" HREF="node135.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html4556" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html4558" HREF="node256.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html4561" HREF="node137.html">7.16 Gridding of data,</A> <B> Up:</B> <A NAME="tex2html4555" HREF="node121.html">7. Creating GMT Graphics</A> <B> Previous:</B> <A NAME="tex2html4549" HREF="node135.html">7.14 Gridding of data</A> <B> <A NAME="tex2html4557" HREF="node1.html">Contents</A></B> <B> <A NAME="tex2html4559" HREF="node256.html">Index</A></B> <BR> <BR> <!--End of Navigation Panel--> <H1><A NAME="SECTION0015150000000000000000"></A> <A NAME="sec:example_15"></A><A NAME="24487"></A> <BR> 7.15 Gridding, contouring, and masking of unconstrained areas </H1> <P> This example (Figure <A HREF="#fig:GMT_example_15">7.15</A>) demonstrates some off the different ways one can use to grid data in <A NAME="tex2html1405" HREF="http://gmt.soest.hawaii.edu"><B>GMT</B></A>, and how to deal with unconstrained areas. We first convert a large ASCII file to binary with <A NAME="tex2html1406" HREF="../man/gmtconvert.html"><I><B>gmtconvert</B></I></A><A NAME="25223"></A> since the binary file will read and process much faster. Our lower left plot illustrates the results of gridding using a nearest neighbor technique (<A NAME="tex2html1407" HREF="../man/nearneighbor.html"><I><B>nearneighbor</B></I></A><A NAME="25228"></A>) which is a local method: No output is given where there are no data. Next (lower right), we use a minimum curvature technique (<A NAME="tex2html1408" HREF="../man/surface.html"><I><B>surface</B></I></A><A NAME="25233"></A>) which is a global method. Hence, the contours cover the entire map although the data are only available for portions of the area (indicated by the gray areas plotted using <A NAME="tex2html1409" HREF="../man/psmask.html"><I><B>psmask</B></I></A><A NAME="25238"></A>). The top left scenario illustrates how we can create a clip path (using <A NAME="tex2html1410" HREF="../man/psmask.html"><I><B>psmask</B></I></A><A NAME="25243"></A>) based on the data coverage to eliminate contours outside the constrained area. Finally (top right) we simply employ <A NAME="tex2html1411" HREF="../man/pscoast.html"><I><B>pscoast</B></I></A><A NAME="25248"></A> to overlay gray land masses to cover up the unwanted contours, and end by plotting a star at the deepest point on the map with <A NAME="tex2html1412" HREF="../man/psxy.html"><I><B>psxy</B></I></A><A NAME="25253"></A>. This point was extracted from the grid files using <A NAME="tex2html1413" HREF="../man/grdinfo.html"><I><B>grdinfo</B></I></A><A NAME="25258"></A>. <P> <BR CLEAR="ALL"> <HR> <BR> <PRE>#!/bin/sh # GMT EXAMPLE 15 # # Purpose: Gridding and clipping when data are missing # GMT progs: blockmedian, gmtconvert, grdclip, grdcontour, grdinfo, minmax # GMT progs: nearneighbor, pscoast, psmask, pstext, surface # Unix progs: awk, echo, rm # ps=example_15.ps gmtconvert ship.xyz -bo > ship.b # region=`minmax ship.b -I1 -bi3` nearneighbor $region -I10m -S40k -Gship.nc ship.b -bi3 info=`grdinfo -C -M ship.nc` grdcontour ship.nc -JM3i -P -B2WSne -C250 -A1000 -G2i -K -U"Example 15 in Cookbook" > $ps # blockmedian $region -I10m ship.b -bi3 -bo > ship_10m.b surface $region -I10m ship_10m.b -Gship.nc -bi3 psmask $region -I10m ship.b -J -O -K -T -Glightgray -bi3 -X3.6i >> $ps grdcontour ship.nc -J -B2WSne -C250 -L-8000/0 -A1000 -G2i -O -K >> $ps # psmask $region -I10m ship_10m.b -bi3 -J -B2WSne -O -K -X-3.6i -Y3.75i >> $ps grdcontour ship.nc -J -C250 -A1000 -L-8000/0 -G2i -O -K >> $ps psmask -C -O -K >> $ps # grdclip ship.nc -Sa-1/NaN -Gship_clipped.nc grdcontour ship_clipped.nc -J -B2WSne -C250 -A1000 -L-8000/0 -G2i -O -K -X3.6i >> $ps pscoast $region -J -O -K -Ggray -Wthinnest >> $ps echo $info | awk '{print $12,$13}' | psxy -R -J -O -K -Sa0.15i -Wthick >> $ps echo "-0.3 3.6 24 0 1 CB Gridding with missing data" | pstext -R0/3/0/4 -Jx1i -O -N >> $ps rm -f ship.b ship_10m.b ship.nc ship_clipped.nc .gmt* </PRE> <BR CLEAR="ALL"> <HR> <DIV ALIGN="CENTER"><A NAME="fig:GMT_example_15"></A><A NAME="25264"></A> <TABLE> <CAPTION ALIGN="BOTTOM"><STRONG>Figure 7.15:</STRONG> Gridding, contouring, and masking of data.</CAPTION> <TR><TD> <DIV ALIGN="CENTER"><IMG WIDTH="491" HEIGHT="545" ALIGN="BOTTOM" BORDER="0" SRC="img174.png" ALT="\includegraphics[scale=0.6]{scripts/example_15}"></DIV></TD></TR> </TABLE> </DIV> <P> <A NAME="24500"></A> <P> <HR> <!--Navigation Panel--> <A NAME="tex2html4560" HREF="node137.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html4554" HREF="node121.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html4548" HREF="node135.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html4556" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html4558" HREF="node256.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html4561" HREF="node137.html">7.16 Gridding of data,</A> <B> Up:</B> <A NAME="tex2html4555" HREF="node121.html">7. Creating GMT Graphics</A> <B> Previous:</B> <A NAME="tex2html4549" HREF="node135.html">7.14 Gridding of data</A> <B> <A NAME="tex2html4557" HREF="node1.html">Contents</A></B> <B> <A NAME="tex2html4559" HREF="node256.html">Index</A></B> <!--End of Navigation Panel--> <ADDRESS> Paul Wessel 2010-07-14 </ADDRESS> </BODY> </HTML>