<!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.25 Global distribution of antipodes</TITLE> <META NAME="description" CONTENT="7.25 Global distribution of antipodes"> <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="node149.html"> <LINK REL="previous" HREF="node147.html"> <LINK REL="up" HREF="node123.html"> <LINK REL="next" HREF="node149.html"> </HEAD> <BODY bgcolor="#ffffff"> <!--Navigation Panel--> <A NAME="tex2html4802" HREF="node149.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html4796" HREF="node123.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html4790" HREF="node147.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html4798" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html4800" HREF="node258.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html4803" HREF="node149.html">7.26 General vertical perspective</A> <B> Up:</B> <A NAME="tex2html4797" HREF="node123.html">7. Creating GMT Graphics</A> <B> Previous:</B> <A NAME="tex2html4791" HREF="node147.html">7.24 Data selection based</A> <B> <A NAME="tex2html4799" HREF="node1.html">Contents</A></B> <B> <A NAME="tex2html4801" HREF="node258.html">Index</A></B> <BR> <BR> <!--End of Navigation Panel--> <H1><A NAME="SECTION0015250000000000000000"></A> <A NAME="sec:example_25"></A><A NAME="25193"></A> <BR> 7.25 Global distribution of antipodes </H1> <P> As promised in Section <A HREF="node146.html#sec:example_23">7.23</A>, we will study antipodes. The antipode of a point at <!-- MATH $(\phi, \lambda)$ --> <IMG WIDTH="43" HEIGHT="31" ALIGN="MIDDLE" BORDER="0" SRC="img194.png" ALT="$(\phi, \lambda)$"> is the point at <!-- MATH $(-\phi, \lambda + 180)$ --> <IMG WIDTH="96" HEIGHT="31" ALIGN="MIDDLE" BORDER="0" SRC="img195.png" ALT="$(-\phi, \lambda + 180)$">. We seek an answer to the question that has plagued so many for so long: Given the distribution of land and ocean, how often is the antipode of a point on land also on land? And what about marine antipodes? We use <A NAME="tex2html1554" HREF="../man/grdlandmask.html"><I><B>grdlandmask</B></I></A><A NAME="26125"></A> and <A NAME="tex2html1555" HREF="../man/grdmath.html"><I><B>grdmath</B></I></A><A NAME="26130"></A> to map these distributions and calculate the area of the Earth (in percent) that goes with each of the three possibilities. To make sense of our <A NAME="tex2html1556" HREF="../man/grdmath.html"><I><B>grdmath</B></I></A><A NAME="26135"></A> equations below, note that we first calculate a grid that is +1 when a point and its antipode is on land, -1 if both are in the ocean, and 0 elsewhere. We then seek to calculate the area distribution of dry antipodes by only pulling out the nodes that equal +1. As each point represent an area approximated by <!-- MATH $\Delta \phi \times \Delta \lambda$ --> <IMG WIDTH="61" HEIGHT="31" ALIGN="MIDDLE" BORDER="0" SRC="img196.png" ALT="$\Delta \phi \times \Delta \lambda$"> where the <!-- MATH $\Delta \lambda$ --> <IMG WIDTH="25" HEIGHT="31" ALIGN="MIDDLE" BORDER="0" SRC="img197.png" ALT="$\Delta \lambda$"> term's actual dimension depends on <IMG WIDTH="48" HEIGHT="31" ALIGN="MIDDLE" BORDER="0" SRC="img198.png" ALT="$\cos (\phi)$">, we need to allow for that shrinkage, normalize our sum to that of the whole area of the Earth, and finally convert that ratio to percent. Since the <!-- MATH $\Delta \lambda$ --> <IMG WIDTH="25" HEIGHT="31" ALIGN="MIDDLE" BORDER="0" SRC="img197.png" ALT="$\Delta \lambda$">, <IMG WIDTH="24" HEIGHT="29" ALIGN="MIDDLE" BORDER="0" SRC="img199.png" ALT="$\Delta \phi$"> terms appear twice in these expressions they cancel out, leaving the somewhat intractable expressions below where the sum of <IMG WIDTH="48" HEIGHT="31" ALIGN="MIDDLE" BORDER="0" SRC="img198.png" ALT="$\cos (\phi)$"> for all <IMG WIDTH="14" HEIGHT="29" ALIGN="MIDDLE" BORDER="0" SRC="img200.png" ALT="$\phi$"> is known to equal <IMG WIDTH="46" HEIGHT="31" ALIGN="MIDDLE" BORDER="0" SRC="img201.png" ALT="$2N_y / \pi$">: <P> <BR CLEAR="ALL"> <HR> <BR> <PRE>#!/bin/sh # GMT EXAMPLE 25 # # Purpose: Display distribution of antipode types # GMT progs: gmtset, grdlandmask, grdmath, grd2xyz, gmtmath, grdimage, pscoast, pslegend # Unix progs: cat # # Create D minutes global grid with -1 over oceans and +1 over land ps=example_25.ps D=30 grdlandmask -Rg -I${D}m -Dc -A500 -N-1/1/1/1/1 -F -Gwetdry.nc # Manipulate so -1 means ocean/ocean antipode, +1 = land/land, and 0 elsewhere grdmath wetdry.nc DUP 180 ROTX FLIPUD ADD 2 DIV = key.nc # Calculate percentage area of each type of antipode match. grdmath -Rg -I${D}m -F Y COSD 60 $D DIV 360 MUL DUP MUL PI DIV DIV 100 MUL = scale.nc grdmath key.nc -1 EQ 0 NAN scale.nc MUL = tmp.nc grd2xyz tmp.nc -S -ZTLf > key.b ocean=`gmtmath -bi1s -Ca -S key.b SUM UPPER RINT =` grdmath key.nc 1 EQ 0 NAN scale.nc MUL = tmp.nc grd2xyz tmp.nc -S -ZTLf > key.b land=`gmtmath -bi1s -Ca -S key.b SUM UPPER RINT =` grdmath key.nc 0 EQ 0 NAN scale.nc MUL = tmp.nc grd2xyz tmp.nc -S -ZTLf > key.b mixed=`gmtmath -bi1s -Ca -S key.b SUM UPPER RINT =` # Generate corresponding color table cat << END > key.cpt -1.5 blue -0.5 blue -0.5 gray 0.5 gray 0.5 red 1.5 red END # Create the final plot and overlay coastlines gmtset ANNOT_FONT_SIZE_PRIMARY +10p PLOT_DEGREE_FORMAT dddF grdimage key.nc -Sn -JKs180/9i -B60/30:."Antipodal comparisons":WsNE -K -Ckey.cpt -Y1.2i \ -U/-0.75i/-0.95i/"Example 25 in Cookbook" > $ps pscoast -R -J -O -K -Wthinnest -Dc -A500 >> $ps # Place an explanatory legend below pslegend -R0/9/0/0.5 -Jx1i/-1i -O -Dx4.5/0/6i/0.3i/TC -Y-0.2i -Fthick >> $ps << END N 3 S 0.15i s 0.2i red 0.25p 0.3i Terrestrial Antipodes [$land %] S 0.15i s 0.2i blue 0.25p 0.3i Oceanic Antipodes [$ocean %] S 0.15i s 0.2i gray 0.25p 0.3i Mixed Antipodes [$mixed %] END rm -f *.nc key.* .gmt* </PRE> <BR CLEAR="ALL"> <HR> <P> In the end we obtain a funny-looking map depicting the antipodal distribution as well as displaying in legend form the requested percentages (Figure <A HREF="#fig:GMT_example_25">7.25</A>). Note that the script is set to evaluate a global 30 minute grid for expediency (<IMG WIDTH="51" HEIGHT="29" ALIGN="MIDDLE" BORDER="0" SRC="img202.png" ALT="$D = 30$">), hence several smaller land masses that do have terrestrial antipodes do not show up. If you want a more accurate map you can set the parameter <IMG WIDTH="16" HEIGHT="14" ALIGN="BOTTOM" BORDER="0" SRC="img203.png" ALT="$D$"> to a smaller increment (try 5 and wait a few minutes). <P> The call to <A NAME="tex2html1557" HREF="../man/grdimage.html"><I><B>grdimage</B></I></A><A NAME="26141"></A> includes the <B>-Sn</B> to suspend interpolation and only return the value of the nearest neighbor. This option is particularly practical for plotting categorical data, like these, that should not be interpolated. <P> <DIV ALIGN="CENTER"><A NAME="fig:GMT_example_25"></A><A NAME="26147"></A> <TABLE> <CAPTION ALIGN="BOTTOM"><STRONG>Figure 7.25:</STRONG> Global distribution of antipodes.</CAPTION> <TR><TD> <DIV ALIGN="CENTER"><IMG WIDTH="554" HEIGHT="329" ALIGN="BOTTOM" BORDER="0" SRC="img204.png" ALT="\includegraphics[width=\textwidth]{scripts/example_25}"></DIV></TD></TR> </TABLE> </DIV> <P> <A NAME="25204"></A> <P> <HR> <!--Navigation Panel--> <A NAME="tex2html4802" HREF="node149.html"> <IMG WIDTH="37" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="next" SRC="next.png"></A> <A NAME="tex2html4796" HREF="node123.html"> <IMG WIDTH="26" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="up" SRC="up.png"></A> <A NAME="tex2html4790" HREF="node147.html"> <IMG WIDTH="63" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="previous" SRC="prev.png"></A> <A NAME="tex2html4798" HREF="node1.html"> <IMG WIDTH="65" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="contents" SRC="contents.png"></A> <A NAME="tex2html4800" HREF="node258.html"> <IMG WIDTH="43" HEIGHT="24" ALIGN="BOTTOM" BORDER="0" ALT="index" SRC="index.png"></A> <BR> <B> Next:</B> <A NAME="tex2html4803" HREF="node149.html">7.26 General vertical perspective</A> <B> Up:</B> <A NAME="tex2html4797" HREF="node123.html">7. Creating GMT Graphics</A> <B> Previous:</B> <A NAME="tex2html4791" HREF="node147.html">7.24 Data selection based</A> <B> <A NAME="tex2html4799" HREF="node1.html">Contents</A></B> <B> <A NAME="tex2html4801" HREF="node258.html">Index</A></B> <!--End of Navigation Panel--> <ADDRESS> Paul Wessel 2011-02-27 </ADDRESS> </BODY> </HTML>