I created a procedure over a year ago to collect earthquake data from the usgs and save it into a file. The procedure pulls data off the internet and saves it in a text file with a date stamp (minus the year - because I haven't been bothered to change it ) in the folder location f:/7 day earthquakes.  Feel free to modify it as you wish.  Here it is, pretty much still in it's original format when I created it.

earthquakedatasave := proc ()
  local a, b, c, d, e, i:
  a := HTTP[Get]("http://earthquake.usgs.gov/earthquakes/catalogs/eqs7day-M1.txt")[2]:
  b := StringTools:-Split(a, "\n"):
  c := Array(1 .. nops(b)-1); for i to nops(b)-1 do
     c[i] := StringTools:-Remove(StringTools:-IsControlCharacter, b[i+1]):
  end do:
  d := convert(c, list):
  e := cat("7 day earthquake", StringTools:-FormatTime("%B%d%H%M"), ".txt"):
  currentdir("f:/7 day earthquakes"):
  writedata(e, d, string):
end proc:

earthquakedatasave()

This saves most earthquake data in the U.S. above magnitude 1 and in the world 2.5 for the last 7 days.  Changing "M1.txt" in line 3 to "M2.5.txt" saves just the world data quakes above mag 2.5, and changing to "M5.txt" saves above 5.  Of course changing the name of the file would also be recommended to not overwrite any previous data saved within the same minute.

Unfortunately there isn't one location that collects all data.  For example the australian data center collects data for New Zealand which the USGS doesn't always pick up and stations in Europe pick up many more again.  Also the USGS one I use here doesn't pick up everything that happens in Yellowstone.  And funnily enough it doesn't always pick up all the >2.5 quakes in Canada but for the most part it does.

earthquake_procedure.mw


Please Wait...