World-wide seismicity the last 7 days
using Printf
D = gmtinfo("@usgs_quakes_22.txt", header=1, F=:i, outcol=2)
n = D[1].data[1]
#D = gmtinfo("@usgs_quakes_22.txt", header=1, colinfo="0T",
per_column=true, inc=1, par=(TIME_UNIT=:d,))
#first = D[1].data[1]
#last = D[1].data[2]
# The above commented lines work but give a numeric time. Still have to find howto convert ot Time string
first = "2017-09-01"
last = "2017-10-01"
# Start plotting. First lay down map, then plot quakes with size = magintude/50":
coast(region=:global360, land=:burlywood, ocean=:lightblue, area=1000,
frame=(annot=45, grid=30, title="World-wide earthquake activity"),
proj=(name=:EckertVI, center=180), figsize=22, yshift=7, portrait=false)
neis = makecpt(color="red,green,blue", range="0,100,300,10000", nobg=true)
plot!("@usgs_quakes_22.txt", cmap=neis, marker=:circle, ml=:faint,
header=1, incol="2,1,3,4+s0.04")
# Create legend input file for NEIS quake plot
neis_legend = text_record([
@sprintf("H 16p,Helvetica-Bold %d events during %s to %s", n, first, last)
"D 0 1p"
"N 3"
"V 0 1p"
"S 0.1i c 0.1i red 0.25p 0.2i Shallow depth (0-100 km)"
"S 0.1i c 0.1i green 0.25p 0.2i Intermediate depth (100-300 km)"
"S 0.1i c 0.1i blue 0.25p 0.2i Very deep (> 300 km)"
"D 0 1p"
"V 0 1p"
"N 7"
"V 0 1p"
"S 0.1i c 0.06i - 0.25p 0.3i M 3"
"S 0.1i c 0.08i - 0.25p 0.3i M 4"
"S 0.1i c 0.10i - 0.25p 0.3i M 5"
"S 0.1i c 0.12i - 0.25p 0.3i M 6"
"S 0.1i c 0.14i - 0.25p 0.3i M 7"
"S 0.1i c 0.16i - 0.25p 0.3i M 8"
"S 0.1i c 0.18i - 0.25p 0.3i M 9"
"D 0 1p"
"V 0 1p"
"N 1"
"G 0.25l"
"P"
"T USGS/NEIS most recent earthquakes for the last seven days. The data were"
"T obtained automatically from the USGS Earthquake Hazards Program page at"
"T @_https://earthquake.usgs.gov@_. Interested users may also receive email alerts"
"T from the USGS."
"T This script can be called daily to update the latest information."
"G 0.4i"
"I @USGS.png 1i RT"
"G -0.3i"
"L 12p,Times-Italic LB GMT guru @@ GMTbox"])
# OK, now we can actually run legend. We center the legend below the map.
legend!(neis_legend, pos=(anchor=:BC, offset=(0,1), width=(18,4.3)),
box=(pen=1,fill=:lightyellow), par=(:FONT_ANNOT_PRIMARY,10), show=true)
See also GMT ex22