x lines of Python: Global seismic data
/Today we'll look at finding and analysing global seismology data with Python and the wonderful seismology package ObsPy, from Moritz Beyreuther, Lion Krischer, and others originally at the Geophysical Observatory in Munich.
We've used ObsPy before to load SEG-Y files into Python, but that's not its core purpose. These tools are typically used by global seismologists and earthquake scientists, but we're going to download and analyse data from three non-earthquakes:
- A curious landslide and tsunami in Greenland.
- The recent nuclear bomb test in North Korea.
- Hurricane Irma's passage through the Caribbean.
We'll also look at an actual earthquake. This morning there was a very large earthquake off Mexico, killing at least 15 people. It's the first M8+ earthquake anywhere since the Illapel event, Chile, on 16 September 2015.
Only 4 lines?
Once you have ObsPy, only 4 lines of code (not counting imports) are needed to download and plot a seismic trace. Here's how to instantiate the ObsPy client using the IRIS data service, then get 5 minutes of waveform data from the Mudanjiang or MDJ station on the IC network, the New China Digital Seismograph Network, and finally plot it:
from obspy.clients.fdsn import Client client = Client("IRIS") from obspy import UTCDateTime t = UTCDateTime("2017-09-03_03:30:00") st = client.get_waveforms("IC", "MDJ", "00", "BHZ", t, t + 5*60) st.plot()
Pretty awesome, right? One day getting seismic and well data will be this simple! LOL
Check out the Jupyter Notebook! I cannot get this notebook to run on Azure Notebooks I'm afraid, so the only way to run it is to set up Python and Jupyter (best way: install Canopy or Anaconda) on your machine. I urge you to give it a go, because what could be more fun than playing around with decades of seismic data from all over the world?