# -*- Mode: Sh -*- # antipodes_gmt -- show antipodes # Copyright : http://www.fsf.org/copyleft/gpl.html # Author : Dan Jacobson -- http://jidanni.org/ # Created On : Thu Jan 3 00:23:52 2002 # Last Modified By: Dan Jacobson # Last Modified On: Wed Aug 4 10:35:10 2004 # Update Count : 97 # Status : just got it to work, haven't refined it yet set -e u="usage: $0 long lat width_in_degrees #center and width $0 -5 40 6 for New Zelanders to visit their antipodes in Spain $0 -157 21 7 Hawaii -- Botswana $0 120 25 50 shows all of South American antipodes in Asia $0 121.3 24.66 0.8 zooms in on Taiwan" test $# -ne 3 && { echo "$u" >&2; exit 9;} T=${file-tmp.ps} set -- $(awk -v long=$1 -v lat=$2 -v width=$3 \ "BEGIN{ if(width<=0){print \"$0: width <0\" > \"/dev/stderr\";error=1} if((long >= 0?long:-long)+width>180){ print \"$0: frontside crossing int'l dateline causes problems at present\"\ > \"/dev/stderr\";error=2} #don't know why, by the way print long-width, long+width, lat-width, lat+width; print (long+360)%360, long+180 #meridian long+=180; lat*=-1; print long-width, long+width, lat-width, lat+width, error}") test ! ${11} R1=$1/$2/$3/$4 Q1=$5 Q2=$6 R2=$7/$8/$9/${10} g=222/0/0; N=1 co=3/$g S=10c #need -W as -N3 won't give coastlines : ${D=i} gmtset BASEMAP_TYPE FANCY #PLAIN #PAPER_MEDIA B5+ #trap "rm $T" 0 #so copy the tmp file before you exit the viewer, if you want it gmtset BASEMAP_FRAME_RGB $g pscoast -JQ$Q1/$S $common -R$R1 -N$N/$co -D$D -P -W$co -K > $T gmtset BASEMAP_FRAME_RGB 0/0/0 test "x$text1" != x && echo -e "$text1"|pstext -JQ$Q1/$S -R$R1 -O -K -G$g>> $T test "x$text2" != x && echo -e "$text2"|pstext -JQ$Q1/$S -R$R1 -O -K >> $T pscoast -JQ$Q2/$S -R$R2 -N$N -D$D -W -M|\ awk '/^[0-9]/{$1+=180;$2*=-1};{print}'|\ psxy -JQ$Q1/$S -R$R1 -M -O >> $T gv $T #Much thanks to Ben Horner-Johnson ben@rice.edu & Luis in France #After I beef this up, perhaps someone should make an #antipodes server... # #perhaps vary -D -A etc. according to the size of region selected # b> Checking your script... skip the -P on the second pscoast command and the # b> psxy command - once it is set with the first pscoast command, it has no # b> function #width=height too inflexible...