Skip to content

Commit

Permalink
Focal mechanism angles are in degrees: units are not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
claudiodsf committed Dec 4, 2023
1 parent e4cfe13 commit 1381122
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions sourcespec/ssp_event.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,12 +229,13 @@ def from_moment_tensor(self, moment_tensor):
class SSPFocalMechanism():
"""
SourceSpec focal mechanism class.
Angles are in degrees.
"""
def __init__(self, strike=None, dip=None, rake=None, units=None):
self.strike = _float(strike)
self.dip = _float(dip)
self.rake = _float(rake)
self.units = units

# make the class subscriptable
def __getitem__(self, key):
Expand All @@ -243,9 +244,9 @@ def __getitem__(self, key):
def __str__(self):
try:
return (
f'Strike: {self.strike:.1f} {self.units}, '
f'Dip: {self.dip:.1f} {self.units}, '
f'Rake: {self.rake:.1f} {self.units}'
f'Strike: {self.strike:.1f}°, '
f'Dip: {self.dip:.1f}°, '
f'Rake: {self.rake:.1f}°'
)
except TypeError as e:
raise TypeError('Incomplete focal mechanism data') from e
Expand Down

0 comments on commit 1381122

Please sign in to comment.