Fixed eventlist not working after locating twice
Changed exception when less then 2 horizontals are found to warning
This commit is contained in:
parent
21453159b7
commit
217fa330c1
8
PyLoT.py
8
PyLoT.py
@ -1496,7 +1496,6 @@ class MainWindow(QMainWindow):
|
|||||||
event = self.get_current_event()
|
event = self.get_current_event()
|
||||||
if not type(outformats) == list:
|
if not type(outformats) == list:
|
||||||
outformats = [outformats]
|
outformats = [outformats]
|
||||||
|
|
||||||
def getSavePath(event, directory, outformats):
|
def getSavePath(event, directory, outformats):
|
||||||
if not directory:
|
if not directory:
|
||||||
title = 'Save event data as {} to directory ...'.format(outformats)
|
title = 'Save event data as {} to directory ...'.format(outformats)
|
||||||
@ -1515,13 +1514,13 @@ class MainWindow(QMainWindow):
|
|||||||
|
|
||||||
uppererrorP = self._inputs['timeerrorsP']
|
uppererrorP = self._inputs['timeerrorsP']
|
||||||
uppererrorS = self._inputs['timeerrorsS']
|
uppererrorS = self._inputs['timeerrorsS']
|
||||||
|
# Inserted to prevent Bug in Eventlist
|
||||||
|
self.get_data().setEvtData(event)
|
||||||
try:
|
try:
|
||||||
self.get_data().applyEVTData(event, typ='event') # getPicks())
|
self.get_data().applyEVTData(event, typ='event') # getPicks())
|
||||||
except OverwriteError:
|
except OverwriteError:
|
||||||
self.get_data().resetPicks()
|
self.get_data().resetPicks()
|
||||||
return self.saveData(event, directory, outformats)
|
return self.saveData(event, directory, outformats)
|
||||||
|
|
||||||
fcheck = ['auto', 'manual', 'origins', 'magnitude']
|
fcheck = ['auto', 'manual', 'origins', 'magnitude']
|
||||||
|
|
||||||
saved_as = str()
|
saved_as = str()
|
||||||
@ -1537,7 +1536,6 @@ class MainWindow(QMainWindow):
|
|||||||
msg = 'Event {} saved as {} in format(s) {}'.format(event.pylot_id, fbasename, saved_as.strip())
|
msg = 'Event {} saved as {} in format(s) {}'.format(event.pylot_id, fbasename, saved_as.strip())
|
||||||
self.update_status(msg)
|
self.update_status(msg)
|
||||||
print(msg)
|
print(msg)
|
||||||
|
|
||||||
event.dirty = False
|
event.dirty = False
|
||||||
self.fill_eventbox()
|
self.fill_eventbox()
|
||||||
return True
|
return True
|
||||||
@ -3012,7 +3010,6 @@ class MainWindow(QMainWindow):
|
|||||||
self.locate_event()
|
self.locate_event()
|
||||||
|
|
||||||
ctrfile = os.path.join(locroot, 'run', parameter['ctrfile'])
|
ctrfile = os.path.join(locroot, 'run', parameter['ctrfile'])
|
||||||
|
|
||||||
ttt = parameter['ttpatter']
|
ttt = parameter['ttpatter']
|
||||||
outfile = parameter['outpatter']
|
outfile = parameter['outpatter']
|
||||||
eventname = self.get_current_event_name()
|
eventname = self.get_current_event_name()
|
||||||
@ -3028,7 +3025,6 @@ class MainWindow(QMainWindow):
|
|||||||
print(e.message)
|
print(e.message)
|
||||||
# finally:
|
# finally:
|
||||||
# os.remove(phasefile)
|
# os.remove(phasefile)
|
||||||
|
|
||||||
self.get_data().applyEVTData(lt.read_location(locpath), typ='event')
|
self.get_data().applyEVTData(lt.read_location(locpath), typ='event')
|
||||||
for event in self.calc_magnitude():
|
for event in self.calc_magnitude():
|
||||||
self.get_data().applyEVTData(event, typ='event')
|
self.get_data().applyEVTData(event, typ='event')
|
||||||
|
@ -221,11 +221,16 @@ class LocalMagnitude(Magnitude):
|
|||||||
|
|
||||||
power = [np.power(tr.data, 2) for tr in st if tr.stats.channel[-1] not
|
power = [np.power(tr.data, 2) for tr in st if tr.stats.channel[-1] not
|
||||||
in 'Z3']
|
in 'Z3']
|
||||||
if len(power) != 2:
|
# checking horizontal count and calculating power_sum accordingly
|
||||||
raise ValueError('Wood-Anderson amplitude defintion only valid for '
|
if len(power) == 1:
|
||||||
'two horizontals: {0} given'.format(len(power)))
|
print ('WARNING: Only one horizontal found for station {0}.'.format(st[0].stats.station))
|
||||||
|
power_sum = power[0]
|
||||||
|
elif len(power) == 2:
|
||||||
power_sum = power[0] + power[1]
|
power_sum = power[0] + power[1]
|
||||||
#
|
else:
|
||||||
|
raise ValueError('Wood-Anderson aomplitude defintion only valid for'
|
||||||
|
' up to two horizontals: {0} given'.format(len(power)))
|
||||||
|
|
||||||
sqH = np.sqrt(power_sum)
|
sqH = np.sqrt(power_sum)
|
||||||
|
|
||||||
# get time array
|
# get time array
|
||||||
|
@ -21,7 +21,6 @@ from pylot.core.util.obspyDMT_interface import qml_from_obspyDMT
|
|||||||
from pylot.core.util.utils import fnConstructor, full_range, check4rotated, \
|
from pylot.core.util.utils import fnConstructor, full_range, check4rotated, \
|
||||||
check4gapsAndMerge, trim_station_components
|
check4gapsAndMerge, trim_station_components
|
||||||
|
|
||||||
|
|
||||||
class Data(object):
|
class Data(object):
|
||||||
"""
|
"""
|
||||||
Data container with attributes wfdata holding ~obspy.core.stream.
|
Data container with attributes wfdata holding ~obspy.core.stream.
|
||||||
@ -288,7 +287,9 @@ class Data(object):
|
|||||||
return
|
return
|
||||||
self.checkEvent(event, fcheck)
|
self.checkEvent(event, fcheck)
|
||||||
self.setEvtData(event)
|
self.setEvtData(event)
|
||||||
|
|
||||||
self.get_evt_data().write(fnout + fnext, format=evtformat)
|
self.get_evt_data().write(fnout + fnext, format=evtformat)
|
||||||
|
|
||||||
# try exporting event
|
# try exporting event
|
||||||
else:
|
else:
|
||||||
evtdata_org = self.get_evt_data()
|
evtdata_org = self.get_evt_data()
|
||||||
|
@ -81,7 +81,6 @@ def locate(fnin, parameter=None):
|
|||||||
:param fnin: external program name
|
:param fnin: external program name
|
||||||
:return: None
|
:return: None
|
||||||
"""
|
"""
|
||||||
|
|
||||||
exe_path = which('NLLoc', parameter)
|
exe_path = which('NLLoc', parameter)
|
||||||
if exe_path is None:
|
if exe_path is None:
|
||||||
raise NLLocError('NonLinLoc executable not found; check your '
|
raise NLLocError('NonLinLoc executable not found; check your '
|
||||||
|
@ -101,3 +101,4 @@ def make_pen(picktype, phase, key, quality):
|
|||||||
linestyle, width = pick_linestyle_pg(picktype, key)
|
linestyle, width = pick_linestyle_pg(picktype, key)
|
||||||
pen = pg.mkPen(rgba, width=width, style=linestyle)
|
pen = pg.mkPen(rgba, width=width, style=linestyle)
|
||||||
return pen
|
return pen
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user