Skip to content

Instantly share code, notes, and snippets.

@kjordahl
Created August 23, 2011 22:53
Show Gist options
  • Save kjordahl/1166837 to your computer and use it in GitHub Desktop.
Save kjordahl/1166837 to your computer and use it in GitHub Desktop.
Plot smoothed version of USGS Community Internet Intensity Map with GMT
#!/bin/sh
wget -O usgs.txt http://earthquake.usgs.gov/earthquakes/dyfi/events/se/082311a/us/cdi_zip.txt
gmtset COLOR_NAN white
gmtset FORMAT_GEO_MAP DF
gmtset FONT_LABEL '16p,Helvetica,black'
I=0.1
R=`awk '{FS=","; print $6, $5, $2}' usgs.txt | minmax -I1`
echo $R
N=`awk 'BEGIN{FS=","}{SUM += $3} END {print SUM}' usgs.txt`
R=-R-85/-70/34/45
awk '{FS=","; print $6, $5, $2, $3}' usgs.txt | blockmedian $R -I$I -Wi -V > filt.txt
nearneighbor filt.txt -Gshake.grd $R -I$I -S1 -N4 -V
makecpt -T0/6/1 -Z > shake.cpt
grdimage shake.grd -Cshake.cpt -JM6i -P -Y2.5i -B5f1 -V -K > shake.ps
pscoast -J -R -Dh -W1p -Swhite -N1 -N2 -A10000 -K -O >> shake.ps
psscale -Y-1.5i -D3i/1i/6i/0.25ih -Cshake.cpt -B1:Intensity: -Ur/1.5i/-0.25i/"Kelsey Jordahl <kjordahl@@alum.mit.edu>" -O >> shake.ps
gv shake.ps &
ps2raster shake.ps -A -P -Tg
echo $N reports
@kjordahl
Copy link
Author

It is the reported shaking data for a particular earthquake, the M5.8 Virginia quake on Aug. 23, 2011. It's the same data used to plot the USGS shakemap.

@Blessingshumba
Copy link

This is now an old poster but i guess things have changed..I cant locate the cdi_zip.txt file. I need to know exacly what those columns $6, $5 and $2 from the awk represents..that is if you can remember

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment