This note documents a simple in-class activity that I use in my GEOSC 109H earthquakes and society class. In class I describe the Gutenberg-Richter Relation that represents the distribution of earthquakes as a function of magnitude (a nice paper-based activity is available from SCEC). I show the students a plot from the GCMT catalog in class, in this activity, they use Mathematica to download data for a few randomly chosen years and see if the pattern I showed in class holds up.
The Mathematica notebook begins with a few utility functions that allow students to use web services to acquire seismicity data and a few functions to list some events (which is partly a check to see that things are working). Below is a listing of the search script (an example usage is provided below).
comcatRectangularSearchPath[start_, end_, minlat_, maxlat_, minlon_, maxlon_] := Module[{},
"http://earthquake.usgs.gov/fdsnws/event/1/query?format=csv&starttime=" <>
DateString[start, "ISODateTime"] <> "&endtime=" <>
DateString[end, "ISODateTime"] <>
"&minmagnitude=4.0&minlatitude=" <>
ToString[Round[minlat, 0.001]] <>
"&maxlatitude=" <>
ToString[Round[maxlat, 0.001]] <>
"&minlongitude=" <>
ToString[Round[minlon, 0.001]] <> "&maxlongitude=" <>
ToString[Round[maxlon, 0.001]] <> "&orderby=time-asc"
]
comcatRectangularSearch[start_, end_, minlat_: - 90, maxlat_: 90,
minlon_: - 180, maxlon_: 180] := Module[{path},
path = comcatRectangularSearchPath[start, end, minlat, maxlat, minlon, maxlon];
{path, Import[path, "CSV"]}
]
The scripts are simplistic, and to avoid errors for some of the more active years, I limit the magnitude range of the analysis to events greater than or equal to magnitude 4.0. The code below is a function to list the largest events in the search results.