pygmi.seis.beachball#
Plot fault plane solutions.
The code below is translated from bb.m written by Andy Michael and Oliver Boyd at http://www.ceri.memphis.edu/people/olboyd/Software/Software.html
Classes#
Matplotlib canvas widget for the actual plot. |
|
Create shapefiles with beachballs. |
Functions#
|
Beachball. |
|
Polar to cartesian coordinates. |
|
Get Strike and dip of second plane. |
|
Find strike and dip of plane given normal vector. |
|
Adapted from code, mij2d.f, created by Chen Ji. |
|
TDL. |
Module Contents#
- class pygmi.seis.beachball.MyMplCanvas(parent=None)#
Bases:
matplotlib.backends.backend_qtagg.FigureCanvasQTAgg
Matplotlib canvas widget for the actual plot.
- Parameters:
parent (parent, optional) – Reference to the parent routine. The default is None.
- init_graph()#
Initialize the graph.
- Return type:
None.
- class pygmi.seis.beachball.BeachBall(parent=None)#
Bases:
pygmi.misc.BasicModule
Create shapefiles with beachballs.
- Parameters:
parent (parent, optional) – Reference to the parent routine. The default is None.
- data_init()#
Initialise Data - entry point into routine.
- Returns:
True if successful, False otherwise.
- Return type:
bool
- setupui()#
Set up UI.
- Return type:
None.
- save_shp()#
Save Beachballs.
- Returns:
True if successful, False otherwise.
- Return type:
bool
- change_alg()#
Change algorithm.
- Return type:
None.
- settings(nodialog=False)#
Entry point into item.
- Parameters:
nodialog (bool, optional) – Run settings without a dialog. The default is False.
- Returns:
True if successful, False otherwise.
- Return type:
bool
- saveproj()#
Save project data from class.
- Return type:
None.
- pygmi.seis.beachball.beachball(fm, centerx, centery, diam, isgeog, *, showlog=print)#
Beachball.
Source code provided here are adopted from MatLab script bb.m written by Andy Michael and Oliver Boyd.
function bb(fm, centerx, centery, diam, ta, color) Draws beachball diagram of earthquake double-couple focal mechanism(s). S1, D1, and R1, the strike, dip and rake of one of the focal planes, can be vectors of multiple focal mechanisms.
- Parameters:
fm (numpy array) – focal mechanism that is either number of mechanisms (NM) by 3 (strike, dip, and rake) or NM x 6 (mxx, myy, mzz, mxy, mxz, myz - the six independent components of the moment tensor). The strike is of the first plane, clockwise relative to north. The dip is of the first plane, defined clockwise and perpendicular to strike, relative to horizontal such that 0 is horizontal and 90 is vertical. The rake is of the first focal plane solution. 90 moves the hanging wall up-dip (thrust), 0 moves it in the strike direction (left-lateral), -90 moves it down-dip (normal), and 180 moves it opposite to strike (right-lateral).
centerx (float) – place beachball(s) at position centerx
centery (float) – place beachball(s) at position centery
diam (float) – draw beachball with this diameter.
isgeog (bool) – True if in geographic coordinates, False otherwise.
showlog (function, optional) – Routine to show text messages. The default is print.
- Returns:
X (numpy array) – array of x coordinates for vertices
Y (numpy array) – array of y coordinates for vertices
xx (numpy array) – array of x coordinates for vertices
yy (numpy array) – array of y coordinates for vertices
- pygmi.seis.beachball.pol2cart(phi, rho)#
Polar to cartesian coordinates.
- Parameters:
phi (numpy array) – Polar angles in radians.
rho (numpy array) – Polar r values.
- Returns:
xxx (numpy array) – X values.
yyy (numpy array) – Y values.
- pygmi.seis.beachball.auxplane(s1, d1, r1)#
Get Strike and dip of second plane.
Adapted from Andy Michael bothplanes.c
- Parameters:
s1 (numpy array) – Strike 1.
d1 (numpy array) – Dip 1.
r1 (numpy array) – Rake 1.
- Returns:
strike (numpy array) – Strike of second plane.
dip (numpy array) – Dip of second plane.
rake (numpy array) – Rake of second plane.
- pygmi.seis.beachball.strikedip(n, e, u)#
Find strike and dip of plane given normal vector.
Adapted from Andy Michaels stridip.c
- Parameters:
n (numpy array) – North coordinates for normal vector.
e (numpy array) – East coordinate for normal vector.
u (numpy array) – Up coordinate for normal vector.
- Returns:
strike (numpy array) – Strike of plane.
dip (numpy array) – Dip of plane.
- pygmi.seis.beachball.mij2sdr(mxx, myy, mzz, mxy, mxz, myz)#
Adapted from code, mij2d.f, created by Chen Ji.
- Parameters:
float (myz -) – independent component of the moment tensor
float – independent component of the moment tensor
float – independent component of the moment tensor
float – independent component of the moment tensor
float – independent component of the moment tensor
float – independent component of the moment tensor
- Returns:
strike (float) – strike of first focal plane (degrees)
dip (float) – dip of first focal plane (degrees)
rake (float) – rake of first focal plane (degrees)
- pygmi.seis.beachball.TDL(AN, BN)#
TDL.
- Parameters:
AN (numpy array) – array comprising XN, YN, ZN
BN (numpy array) – array comprising XE, YE, ZE
- Returns:
FT (float) – relates to strike (360 - ft)
FD (float) – dip
FL (float) – relates to rake (180 - fl)