(24) Data selection based on geospatial criteria¶
Although we are not seismologists, we have yet another example involving
seismicity. We use seismicity data for the Australia/New Zealand region
to demonstrate how we can extract subsets of data using geospatial
criteria. In particular, we wish to plot the epicenters given in the remote
oz_quakes_24.txt as red or green circles. Green circles should only be used for
epicenters that satisfy the following three criteria:
- They are located in the ocean and not on land
- They are within 3000 km of Hobart
- They are more than 1000 km away from the International Dateline
All remaining earthquakes should be plotted in red. Rather that doing the selection process twice we simply plot all quakes as red circles and then replot those that pass our criteria. Most of the work here is done by gmtselect; the rest is carried out by the usual coast and plot workhorses. Note for our purposes the Dateline is just a line along the 180 meridian.
The script produces the plot in Figure. Note that the horizontal distance from the dateline seems to increase as we go south; however that is just the projected distance (Mercator distortion) and not the actual distance which remains constant at 1000 km.
#!/usr/bin/env bash # GMT EXAMPLE 24 # # Purpose: Extract subsets of data based on geospatial criteria # GMT modules: select, coast, plot, info # Unix progs: echo, cat, rm # # Highlight oceanic earthquakes within 3000 km of Hobart and > 1000 km from dateline gmt begin ex24 echo "147:13 -42:48 6000" > point.txt cat <<- END > dateline.txt > Our proxy for the dateline 180 0 180 -90 END R=`gmt info -I10 @oz_quakes_24.txt` gmt coast $R -JM9i -Gtan -Sdarkblue -Wthin,white -Dl -A500 -Ba20f10g10 -BWeSn gmt plot @oz_quakes_24.txt -Sc0.05i -Gred gmt select @oz_quakes_24.txt -Ldateline.txt+d1000k -Nk/s -Cpoint.txt+d3000k -fg -Il \ | gmt plot -Sc0.05i -Ggreen gmt plot point.txt -SE- -Wfat,white gmt text point.txt -F+f14p,Helvetica-Bold,white+jLT+tHobart -D0.1i/-0.1i gmt plot point.txt -Wfat,white -S+0.2i gmt plot dateline.txt -Wfat,white -A rm -f point.txt dateline.txt gmt end show