Compare commits

...

2 Commits

2 changed files with 9 additions and 8 deletions

View File

@ -400,30 +400,28 @@ class MomentMagnitude(Magnitude):
print("WARNING: No instrument corrected data available," print("WARNING: No instrument corrected data available,"
" no magnitude calculation possible! Go on.") " no magnitude calculation possible! Go on.")
continue continue
wf = self.stream.select(station=station)
if not wf:
continue
try: try:
scopy = self.stream.copy() scopy = wf.copy()
except AssertionError: except AssertionError:
print("WARNING: Something's wrong with the data," print("WARNING: Something's wrong with the data,"
"station {}," "station {},"
"no calculation of moment magnitude possible! Go on.".format(station)) "no calculation of moment magnitude possible! Go on.".format(station))
continue continue
wf = scopy.select(station=station)
if not wf:
continue
onset = pick.time onset = pick.time
distance = degrees2kilometers(a.distance) distance = degrees2kilometers(a.distance)
azimuth = a.azimuth azimuth = a.azimuth
incidence = a.takeoff_angle incidence = a.takeoff_angle
w0, fc = calcsourcespec(wf, onset, self.p_velocity, distance, w0, fc = calcsourcespec(scopy, onset, self.p_velocity, distance,
azimuth, incidence, self.p_attenuation, azimuth, incidence, self.p_attenuation,
self.plot_flag, self.verbose) self.plot_flag, self.verbose)
if w0 is None or fc is None: if w0 is None or fc is None:
if self.verbose: if self.verbose:
print("WARNING: insufficient frequency information") print("WARNING: insufficient frequency information")
continue continue
WF = select_for_phase(self.stream.select( WF = select_for_phase(scopy, "P")
station=station), a.phase)
WF = select_for_phase(WF, "P")
m0, mw = calcMoMw(WF, w0, self.rock_density, self.p_velocity, m0, mw = calcMoMw(WF, w0, self.rock_density, self.p_velocity,
distance, self.verbose) distance, self.verbose)
self.moment_props = (station, dict(w0=w0, fc=fc, Mo=m0)) self.moment_props = (station, dict(w0=w0, fc=fc, Mo=m0))

View File

@ -7,6 +7,7 @@
:author: Ludger Kueperkoch, BESTEC GmbH :author: Ludger Kueperkoch, BESTEC GmbH
""" """
import warnings import warnings
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import numpy as np import numpy as np
@ -595,6 +596,8 @@ def select_for_phase(st, phase):
alter_comp = compclass.getCompPosition(comp) alter_comp = compclass.getCompPosition(comp)
alter_comp = str(alter_comp[0]) alter_comp = str(alter_comp[0])
sel_st += st.select(component=comp) sel_st += st.select(component=comp)
if len(sel_st) < 1:
sel_st += st.select(component="Q")
sel_st += st.select(component=alter_comp) sel_st += st.select(component=alter_comp)
elif phase.upper() == 'S': elif phase.upper() == 'S':
comps = 'NE' comps = 'NE'