Moment tensor conversions

Transformations between different moment tensor representations using the pyrocko.moment_tensor module.

Convert moment tensor components to strike, dip and rake

Moment tensor construction is shown by using the moment components (in north-east-down coordinate system convention) and conversion to strike, dip and rake. We also show how to extract the P-axis direction.

Download moment_tensor_example1.py

from pyrocko import moment_tensor as pmt
import numpy as num

r2d = 180. / num.pi

magnitude = 6.3  # Magnitude of the earthquake

exp = pmt.magnitude_to_moment(magnitude)  # convert the mag to moment in [Nm]

# init pyrocko moment tensor
m = pmt.MomentTensor(
    mnn=2.34*exp,
    mee=-2.64*exp,
    mdd=0.295*exp,
    mne=1.49*exp,
    mnd=0.182*exp,
    med=-0.975*exp)

print(m)  # print moment tensor

# gives out both nodal planes:
(s1, d1, r1), (s2, d2, r2) = m.both_strike_dip_rake()

print('strike1=%g, dip1=%g, rake1=%g' % (s1, d1, r1))
print('strike2=%g, dip2=%g, rake2=%g' % (s2, d2, r2))


# p-axis normal vector in north-east-down coordinates
p_ned = m.p_axis().A[0]

print('p_ned=(%g, %g, %g)' % tuple(p_ned))

# convert to azimuth and dip
p_azimuth = num.arctan2(p_ned[1], p_ned[0]) * r2d
p_dip = num.arcsin(p_ned[2]) * r2d

print('p_azimuth=%g, p_dip=%g' % (p_azimuth, p_dip))

Strike, dip and rake to moment tensor

Conversion from strike, dip and rake to the moment tensor. Afterwards we normalize the moment tensor.

Download moment_tensor_example2.py

from pyrocko import moment_tensor as pmt

magnitude = 6.3  # Magnitude of the earthquake

m0 = pmt.magnitude_to_moment(magnitude)  # convert the mag to moment

strike = 130
dip = 40
rake = 110
mt = pmt.MomentTensor(strike=strike, dip=dip, rake=rake, scalar_moment=m0)

m6 = [mt.mnn, mt.mee, mt.mdd, mt.mne, mt.mnd, mt.med]  # The six MT components
print(m6/mt.scalar_moment())  # normalized MT components