GMT

I am a big fan of the open-source Generic Mapping Tools (GMT) and use them to create many of my maps and figures. There is a harsh learning curve, so I recommend starting with a working script and editing it to fit your needs. Here is an example GMT script that plots the active and inactive stations in the _US-TA seismic network using the IRIS DMC webservices to access station locations and start/end dates.

_US-TA

#!/bin/bash

#Script to plot a simple map of Alaska and the Lower 48 along with TA stations, both currently operating and previously operating under the network code _US-TA only.

#Call in terminal window with: sh KA_us_TA_17_11_13.sh

#Last edited by Kasey Aderhold November 13, 2017

gmtset PS_PAGE_ORIENTATION landscape

gmtset MAP_FRAME_TYPE plain

#Set file names, one for the postscript and one for the converted .pdf file. Both will be date-stamped with current date.

OUTFILE1=$(date “+%-m-%-d-%-y_TA.ps”)

OUTFILE2=$(date “+%-m-%-d-%-y_TA.pdf”)

#Set appropriate boundaries and projection size

BOUNDS=-180/-64/21/73

PROJ=M7i

#Get all stations that have operated under the _US-TA virtual network at the IRIS DMC, save as file named temp, then remove the header line and save as _US-TA.txt

curl “http://service.iris.edu/fdsnws/station/1/query?net=_US-TA&level=station&format=text&minlat=21&maxlat=73&minlon=-180&maxlon=-64&nodata=404” > temp

tail +2 temp > _US-TA.txt; rm temp;

#Get all stations that have operated under the _US-TA virtual network at the IRIS DMC and are currently operating.

curl “http://service.iris.edu/fdsnws/station/1/query?net=_US-TA&level=station&format=text&minlat=21&maxlat=73&minlon=-180&maxlon=-64&endafter=2018-10-01T00:00:00&nodata=404” > temp

tail +2 temp > _US-TA_active.txt; rm temp;

#Create map, blank with no topography, use previously defined boundaries and projection.

pscoast -V -R$BOUNDS -J$PROJ -Dl -W0.25p,150 -Swhite -Gwhite -B0 -A500 -N1/0.25p,150 -N2/0.25p,150 -K > $OUTFILE1

#Plot _US-TA stations using text files created with previous calls to IRIS DMC webservices. Plot inactive stations as grey triangles and active as red circles.

#This call to awk divides the text file into columns based on the | character and then sends the 4th and 3rd columns (lat and lon) to the plotting call in gmt.

awk -F’|’ ‘{print $4,$3}’ _US-TA.txt | gmt psxy -V -R -J -St0.1c -Ggrey -W0.25p -P -O -K >> $OUTFILE1

awk -F’|’ ‘{print $4,$3}’ _US-TA_active.txt | gmt psxy -V -R -J -Sc0.1c -Gred -W0.25p -P -O -K >> $OUTFILE1

#Date stamp and label map

date “+-179 72.75 v. %-m/%-d/%-y _US-TA Stations” | pstext -V -R$BOUNDS -J$PROJ -F+f16p -F+jTL -P -O -K >> $OUTFILE1

gmtset FONT_ANNOT_PRIMARY 10p

#Add legend

pslegend -V -R$BOUNDS -J$PROJ -F+p1p -F -D-152.5/45.5/2.1i/.6i/TC -C0.1i/0.1i -L1.2 -B0 -O -K <<END>> $OUTFILE1

#

G -0.075i

L 10 – L   _US-TA Network Stations

S 0.1i c 0.31c red 0.75p 0.38i Active _US-TA Station

S 0.1i t 0.31c grey 0.75p 0.4i Inactive _US-TA Station

END

#Create pdf version of map

ps2pdf $OUTFILE1 $OUTFILE2

%d bloggers like this: