Skip to content

Commit 7e65edb

Browse files
author
Mike Hearne
authored
Merge pull request #254 from mhearne-usgs/momentfix
Fixed issues with moment tensor products not displaying if strike/dip/rake values not filled in.
2 parents 98f02fd + 85e3c1f commit 7e65edb

3 files changed

Lines changed: 2207 additions & 2188 deletions

File tree

libcomcat/dataframes.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from scipy.special import erfcinv
1616
from obspy.geodetics.base import gps2dist_azimuth
1717
from impactutils.mapping.compass import get_compass_dir_azimuth
18+
from obspy.imaging.beachball import aux_plane, mt2plane, MomentTensor
1819

1920
# local imports
2021
from libcomcat.search import get_event_by_id
@@ -1642,6 +1643,19 @@ def _describe_moment_tensor(event, product):
16421643
strike = fm.nodal_planes.nodal_plane_1.strike
16431644
dip = fm.nodal_planes.nodal_plane_1.dip
16441645
rake = fm.nodal_planes.nodal_plane_1.rake
1646+
else:
1647+
if mt.tensor is not None:
1648+
tensor = MomentTensor(
1649+
mt.tensor.m_rr,
1650+
mt.tensor.m_tt,
1651+
mt.tensor.m_pp,
1652+
mt.tensor.m_rt,
1653+
mt.tensor.m_rp,
1654+
mt.tensor.m_tp,
1655+
1,
1656+
)
1657+
np1 = mt2plane(tensor)
1658+
strike, dip, rake = np1.strike, np1.dip, np1.rake
16451659
if np.isnan(derived_mag):
16461660
derived_mag = evt.magnitudes[0].mag
16471661
if np.isnan(derived_depth):

0 commit comments

Comments
 (0)