SSBW - Python Tutorial 6: ObsPy and Cross Correlation

Mike Brudzinski, Miami University-Oxford

Author Profile

Summary

In this interactive tutorial built for a learning management system, students 1) practice using basic Python syntax, 2) use the ObsPy library to load, plot, and analyze data or metadata 3) use ObsPy to create stream and trace objects for handling seismograms, 4) use the signal.trigger module in ObsPy to detect arrivals, and 5) use the signal.cross_correlation module in ObsPy to perform cross correlation using a template seismogram from a known earthquake to find matching seismograms of other similar earthquakes.

Used this activity? Share your experiences and modifications

Context

Audience

The IRIS Seismology Skill Building Workshop (SSBW), which is a free, online, open-access, large-enrollment, 12-week summer workshop for upper level undergraduates.

Skills and concepts that students must have mastered

This assignment builds on prior experience using basic Python command syntax and variables, a basic understanding of what cross-correlation is, basic components of the ObsPy library (stream objects, read functions), basic use of NumPy and matplotlib functionality for making simple plots, and the ability to retrieve relevant information about programming and seismology from internet research or help pages.

How the activity is situated in the course

This is assignment number 30 of 35 in the Seismology Skill Building Workshop (SSBW).

Goals

Content/concepts goals for this activity

Proficiency with Python, ObsPy, object structures, cross correlation, and automated arrival detection.

Higher order thinking skills goals for this activity

Retrieving relevant information from digital sources to accomplish tasks, using correct programming syntax, evaluating and describing computing output in the context of science concepts.

Other skills goals for this activity

Description and Teaching Materials

Students will:
1. Use ObsPy to read a miniseed seismogram recording from China of a nuclear test in North Korea in 2013 
2. Filter the seismogram to a passband that focuses on the signal of interest 
3. Determine the time length and sampling rate of the seismogram 
4. Use a STA/LTA trigger identification tool to calculate a characteristic function, plot it, and then use it to select a P wave arrival 
5. Convert the seismogram arrival time to a UTC date and time 
6. Trim the seismogram using the detected arrival time 
7. Read another seismogram in 2017 to scan for similar seismic signals 
8. Cross correlate the template from 2013 with the recording from 2017 to detect matches 
9. Trim the 2017 seismogram around the most similar matching signal 
10. Use NumPy and matplotlib to plot the template and match from 2017 to view the similarities

 

Teaching Notes and Tips

This assignment was constructed in the Moodle learning management system, and has been exported in the GIFT format. More information about the syntax of this format can be found here: https://docs.moodle.org/en/GIFT_format

Assessment

This assignment is automatically graded by the learning management system. The number of questions of each type used are:
15 multiple choice questions
5 multiple answer question
1 matching question
8 numeric questions (output values, quantifying output, plot measurement, time conversion, calculation)
1 free response (all accepted) question

References and Resources

During the Seismology Skill Building Workshop, students are provided with a virtual Linux machine that was tailored to include the software specifically needed to complete the assignments. This software is all freely available on the internet, but interested parties are encouraged to contact the instructor for access to this tailored virtual machine.