LAB 6 - Focal Mechanisms#
In seismology research, we deal with large volumes of time-series data. Python provides an excellent set of tools for handling these data: Obspy
.
import glob
from obspy.core import read
The second line here imports the obspy package for dealing with seismic data.
We can also import some of the familar toolkits we have been using already:
#you can use these libraries by refering to their appreviation plt., np. or pd.
#basic plotting library
import matplotlib.pyplot as plt
#scientifc computing library
import numpy as np
#data analysis tool
import pandas as pd
# Try it here!
import glob
from obspy.core import read
import matplotlib.pyplot as plt
#scientifc computing library
import numpy as np
#data analysis tool
import pandas as pd
for file in glob.glob('*.z'):
st = read(file)
tr = st[0]
msg = "%s %s %f %f" % (tr.stats.station, str(tr.stats.starttime),
tr.data.mean(), tr.data.std())
print(msg)
We can make focal mechanism or beachball plots using obspy.
Here are three examples of different faulting mechanisms. Identify each one.
Then try change the color of the plots, their size, and orientation of the fault.
from obspy.imaging.beachball import beachball
The focal mechanism can be given by 3 (strike, dip, and rake) components.
focalmechs = [150, 87, 1]
beachball(focalmechs)


Try changing the inputs/components to make the 3 major types of faults.
#Try it here
For those of you who have background in tensors.#
You can also make focal mechanisms based upon the 6 independent components of the moment tensor (Mxx, Myy, Mzz, Mxy, Mxz, Myz).
#Try it here
mt = [0.91, -0.89, -0.02, 1.78, -1.55, 0.47]
beachball(mt, size=200, linewidth=2, facecolor='b')
mt2 = [50, 90, 1]
beachball(mt2, size=200, linewidth=2, facecolor='r')
mt3 = [-2.39, 1.04, 1.35, 0.57, -2.94, -0.94]
beachball(mt3, size=200, linewidth=2, facecolor='g')



