This is an intro to  some basic tasks in seismology, performed in the python package obspy. Obspy has extensive documentation, tutorials and even a sandbox to play in, but if you are completely new to obspy, you may find the following useful.

Installations

I am going to assume you only have python on your computer, but if you have obspy and jupyter running, you can skip this section.

To get the necessary packages, I strongly encourage the use of the conda package manager. To install conda, go here.

After that, getting different python packages is a breeze. To get 2D plotting tools from matplotlib, type on the command line:

conda install matplotlib

Python’s answers to GIS or Generic Mapping Tool (GMT) is cartopy (there are others, such as basemap):

conda install cartopy

To get obspy, follow these simple instructions.

The following tutorials will be run in jupyter:

conda install jupyter

After this, you can run a jupyter notebook, by typing on the command line:

jupyter notebook nameofyournotebook.ipynb

These notebooks are meant to illustrate the use of obspy, in this case, but you can export the results of a jupyter notebook to html, or pdf, and even to a .py file, as a “clean” python programme.

Workflow

Let’s break down a basic seismology workflow into the tasks below. Each is a hyperlink to a notebook. To run the first notebook, for example, download it, and run “jupyter notebook create_catalogue.ipynb”

  1. Reading and writing a catalogue of events
  2. Creating an inventory of stations — with their instrument response — that recorded these events
  3. Retrieving seismic data from the stations in the inventory from the events in the catalogue, and performing an instrument response correction
  4. Annotating these data with taup-predicted arrival times, based on station and event location and origin time.