Save only picks for NLLoc, VELEST, etc. that not exceed adjusted uncertainties.
This commit is contained in:
parent
e3a4a2861d
commit
49092a928e
@ -1079,6 +1079,10 @@ class MainWindow(QMainWindow):
|
||||
settings = QSettings()
|
||||
fbasename = self.getEventFileName()
|
||||
exform = settings.value('data/exportFormat', 'QUAKEML')
|
||||
|
||||
uppererrorP = self._inputs['timeerrorsP']
|
||||
uppererrorS = self._inputs['timeerrorsS']
|
||||
|
||||
try:
|
||||
self.get_data().applyEVTData(self.get_current_event(), typ='event')#getPicks())
|
||||
except OverwriteError:
|
||||
@ -1097,7 +1101,7 @@ class MainWindow(QMainWindow):
|
||||
# return False
|
||||
# MP MP changed to suppress unnecessary user prompt
|
||||
try:
|
||||
self.get_data().exportEvent(fbasename, exform)
|
||||
self.get_data().exportEvent(fbasename, exform, upperErrors=[uppererrorP[3], uppererrorS[3]])
|
||||
except FormatError as e:
|
||||
fbasename, exform = getSavePath(e, directory, outformat)
|
||||
except AttributeError as e:
|
||||
@ -1119,7 +1123,7 @@ class MainWindow(QMainWindow):
|
||||
# return False
|
||||
|
||||
# export to given path
|
||||
self.get_data().exportEvent(fbasename, exform)
|
||||
self.get_data().exportEvent(fbasename, exform, upperErrors=[uppererrorP[3], uppererrorS[3]])
|
||||
# all files save (ui clean)
|
||||
self.update_status('Picks saved as %s' % (fbasename + exform))
|
||||
self.disableSaveManualPicksAction()
|
||||
|
@ -147,10 +147,9 @@ class Data(object):
|
||||
# handle forbidden filenames especially on windows systems
|
||||
return fnConstructor(str(ID))
|
||||
|
||||
def exportEvent(self, fnout, fnext='.xml', fcheck='auto'):
|
||||
def exportEvent(self, fnout, fnext='.xml', fcheck='auto', upperErrors=None):
|
||||
|
||||
"""
|
||||
|
||||
:param fnout:
|
||||
:param fnext:
|
||||
:param fcheck:
|
||||
@ -188,10 +187,32 @@ class Data(object):
|
||||
|
||||
# try exporting event via ObsPy
|
||||
else:
|
||||
# check for stations picked automatically as well as manually
|
||||
# Prefer manual picks!
|
||||
evtdata_copy = self.get_evt_data().copy()
|
||||
evtdata_org = self.get_evt_data()
|
||||
if upperErrors:
|
||||
# check for pick uncertainties exceeding adjusted upper errors
|
||||
# Picks with larger uncertainties will not be saved in output file!
|
||||
for j in range(len(evtdata_org.picks)):
|
||||
for i in range(len(evtdata_copy.picks)):
|
||||
if evtdata_copy.picks[i].phase_hint[0] == 'P':
|
||||
if evtdata_copy.picks[i].time_errors['lower_uncertainty'] >= upperErrors[0] or \
|
||||
evtdata_copy.picks[i].time_errors['upper_uncertainty'] >= upperErrors[0]:
|
||||
print("Uncertainty exceeds adjusted upper time error!")
|
||||
print("P-Pick of station {} will not be saved in outputfile".format(
|
||||
evtdata_copy.picks[i].waveform_id.station_code))
|
||||
del evtdata_copy.picks[i]
|
||||
break
|
||||
if evtdata_copy.picks[i].phase_hint[0] == 'S':
|
||||
if evtdata_copy.picks[i].time_errors['lower_uncertainty'] >= upperErrors[1] or \
|
||||
evtdata_copy.picks[i].time_errors['upper_uncertainty'] >= upperErrors[1]:
|
||||
print("Uncertainty exceeds adjusted upper time error!")
|
||||
print("S-Pick of station {} will not be saved in outputfile".format(
|
||||
evtdata_copy.picks[i].waveform_id.station_code))
|
||||
del evtdata_copy.picks[i]
|
||||
break
|
||||
|
||||
# check for stations picked automatically as well as manually
|
||||
# Prefer manual picks!
|
||||
for i in range(len(evtdata_org.picks)):
|
||||
if evtdata_org.picks[i].method_id == 'manual':
|
||||
mstation = evtdata_org.picks[i].waveform_id.station_code
|
||||
|
Loading…
Reference in New Issue
Block a user