I’m Joshua (or joshu, or @shu). I studied Geophysics, but now I work as an SRE. For fun, I read, make computers do math, go for hikes, and take pictures of things. Some of that makes its way onto here.
“Fearchar” should be pronounced FARE-uh-car, though pretty much everyone pronounces it FEAR-char.
After a big earthquake, I’m always tempted to pull some data from various sources and see what kind of graphs I can produce. My friend Charlie found the NOAA tide data by station, once again driving home the point that NOAA (and USGS, to a lesser extent) is great at collecting data but not that great about indexing it in a way that makes it easy to find by a casual user.
USGS, however, publishes a catalog of earthquakes in various formats; they offer a list of the last earthquakes >= 2.5 Mw in the last week: in Atom/RSS if you’d like to track it in a feedreader, or in CSV for more base crunching. I decided to use R for the more base crunching. But first, a little bash:
#!bash curl -s "http://earthquake.usgs.gov/earthquakes/catalogs/eqs7day-M2.5.txt" | grep -Ee '^(.*Japan|Src,)' | sed -En -e '1,/05:46:23 UTC/ p' > ~/japan-earthquakes.csv
Then opened R, and ran:
earthquakes <- read.csv(file="~/japan-earthquakes.csv",head=TRUE, sep=",") times <- strptime(earthquakes$Datetime, format="%A, %B %d, %Y %H:%M:%S UTC", tz="UTC") times <- times - timesdistances <- ((earthquakes$Lat - earthquakes$Lat) ** 2 + (earthquakes$Lon - earthquakes$Lon) ** 2) ** 0.5
Having all of the data now compiled, we can do things like produce a histogram, demarcated at every 24 hours, of frequency with time:
hist(times, freq=F, breaks=0:60 * 3600, col=heat.colors(24), main="Histogram of time", xlab="time (in seconds)", ylab="frequency")
or a histogram of magnitude:
hist(earthquakes$Magnitude, freq=F, breaks=45:90/10, col=heat.colors(45), main="Histogram of earthquake magnitude", xlab="magnitude (Mw)")
or a histogram of distances:
hist(distances,freq=F,breaks=0:50/10,col=heat.colors(50), xlab='distances (in degrees)',main='Histogram of distances')