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#

BeachBall

Create shapefiles with beachballs.

Functions#

beachball(fm, icenterx, icentery, idiam, isgeog, *[, ...])

Beachball.

pol2cart(phi, rho)

Polar to cartesian coordinates.

auxplane(s1, d1, r1)

Get Strike and dip of second plane.

strikedip(n, e, u)

Find strike and dip of plane given normal vector.

mij2sdr(mxx, myy, mzz, mxy, mxz, myz)

Adapted from code, mij2d.f, created by Chen Ji.

TDL(AN, BN)

TDL.

Module Contents#

class pygmi.seis.beachball.BeachBall(parent=None)#

Bases: pygmi.misc.BasicModule

Create shapefiles with beachballs.

Parameters:

parent – Reference to the parent routine. The default is None.

data_init()#

Initialise Data.

Entry point into routine. This entry point exists for the case where data must be initialised before entering at the standard ‘settings’ sub module.

Returns:

True if successful, False otherwise.

Return type:

bool

setupui()#

Set up UI.

save_shp()#

Save Beachballs.

Returns:

True if successful, False otherwise.

Return type:

bool

change_alg()#

Change algorithm.

settings(nodialog=False)#

Entry point into item.

Parameters:

nodialog (bool) – Run settings without a dialog. The default is False.

Returns:

True if successful, False otherwise.

Return type:

bool

saveproj()#

Save project data from class.

update_graph()#

Initialize the graph.

pygmi.seis.beachball.beachball(fm, icenterx, icentery, idiam, 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, icenterx, icentery, idiam, 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.typing.NDArray) – 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).

  • icenterx (float) – Place beachball(s) at position icenterx

  • icentery (float) – Place beachball(s) at position icentery

  • idiam (float) – Draw beachball with this diameter.

  • isgeog (bool) – True if in geographic coordinates, False otherwise.

  • showlog (collections.abc.Callable[..., None]) – Routine to show text messages. The default is print.

Returns:

  • X (ndarray) – Array of x coordinates for vertices

  • Y (ndarray) – Array of y coordinates for vertices

  • xx (ndarray) – Array of x coordinates for vertices

  • yy (ndarray) – Array of y coordinates for vertices

Return type:

tuple[numpy.typing.NDArray, numpy.typing.NDArray, numpy.typing.NDArray | None, numpy.typing.NDArray | None] | None

pygmi.seis.beachball.pol2cart(phi, rho)#

Polar to cartesian coordinates.

Parameters:
  • phi (numpy.typing.NDArray) – Polar angles in radians.

  • rho (numpy.typing.NDArray) – Polar r values.

Returns:

  • xxx (ndarray) – X values.

  • yyy (ndarray) – Y values.

Return type:

tuple[numpy.typing.NDArray, numpy.typing.NDArray]

pygmi.seis.beachball.auxplane(s1, d1, r1)#

Get Strike and dip of second plane.

Adapted from Andy Michael bothplanes.c

Parameters:
  • s1 (numpy.typing.NDArray) – Strike 1.

  • d1 (numpy.typing.NDArray) – Dip 1.

  • r1 (numpy.typing.NDArray) – Rake 1.

Returns:

  • strike (ndarray) – Strike of second plane.

  • dip (ndarray) – Dip of second plane.

  • rake (ndarray) – Rake of second plane.

Return type:

tuple[numpy.typing.NDArray, numpy.typing.NDArray, numpy.typing.NDArray]

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.typing.NDArray) – North coordinates for normal vector.

  • e (numpy.typing.NDArray) – East coordinate for normal vector.

  • u (numpy.typing.NDArray) – Up coordinate for normal vector.

Returns:

  • strike (ndarray) – Strike of plane.

  • dip (ndarray) – Dip of plane.

Return type:

tuple[numpy.typing.NDArray, numpy.typing.NDArray]

pygmi.seis.beachball.mij2sdr(mxx, myy, mzz, mxy, mxz, myz)#

Adapted from code, mij2d.f, created by Chen Ji.

Parameters:
  • mxx (float) – Independent component of the moment tensor

  • myy (float) – Independent component of the moment tensor

  • mzz (float) – Independent component of the moment tensor

  • mxy (float) – Independent component of the moment tensor

  • mxz (float) – Independent component of the moment tensor

  • myz (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)

Return type:

tuple[float, float, float]

pygmi.seis.beachball.TDL(AN, BN)#

TDL.

Parameters:
  • AN (numpy.typing.NDArray) – Array comprising XN, YN, ZN

  • BN (numpy.typing.NDArray) – Array comprising XE, YE, ZE

Returns:

  • FT (float) – Relates to strike (360 - ft)

  • FD (float) – Dip

  • FL (float) – Relates to rake (180 - fl)

Return type:

tuple[float, float, float] | None