SSBW - Python Tutorial 3: Pandas and an Earthquake Cross-Section

Mike Brudzinski, Miami University-Oxford

Author Profile


In this interactive tutorial built for a learning management system, students 1) practice using the basic syntax of Python commands, 2) use the functionality of the Pandas module to create DataFrames to store data, 3) use the Pandas read_csv function to input seismicity retrieved with IRIS FetchEvent web services, 4) use the Matplotlib module and pyplot functions to make plots of the seismicity, and 5) evaluate the trajectory of a subducting plate from a seismicity map and cross-section.

Used this activity? Share your experiences and modifications



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 the Linux command line environment, the Python syntax, variables, and array functionality, the matplotlib module, the IRIS FetchEvent web services tool, 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 27 of 35 in the Seismology Skill Building Workshop (SSBW).


Content/concepts goals for this activity

Proficiency with Python, Pandas, DataFrames object structure, Matplotlib, cross-section plots, and subduction zones seismicity.

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. Execute system commands from inside a Python program 
2. Retrieve a catalog of earthquakes from the Oaxaca area of Mexico with FetchEvent 
3. Input the catalog into Python using the Pandas read_csv function 
4. Use functions of the Pandas DataFrame to interrogate the catalog 
5. Create a north-south cross-section from the latitude and depth of the catalog 
6. Plot the catalog as symbols using matplolib functions 
7. Evaluate the trajectory of the subducting plate from the seismicity map and cross-section


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:


This assignment is automatically graded by the learning management system. The number of questions of each type used are:
22 multiple choice questions
3 multiple answer question
1 matching question
6 numeric questions (index values, output values, measure values, calculate by ratio)
6 short answer (auto-graded) question
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.