autoPyLoT appends manual picks to xml-file, and manualPyLoT appends automatic picks to xml-file.
This commit is contained in:
parent
b0405cf213
commit
bec8604904
@ -353,7 +353,7 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
|
|||||||
if evt is not None:
|
if evt is not None:
|
||||||
data.applyEVTData(evt, 'event')
|
data.applyEVTData(evt, 'event')
|
||||||
fnqml = '%s/PyLoT_%s' % (event, evID)
|
fnqml = '%s/PyLoT_%s' % (event, evID)
|
||||||
data.exportEvent(fnqml)
|
data.exportEvent(fnqml, fnext='.xml', fcheck='manual')
|
||||||
# HYPO71
|
# HYPO71
|
||||||
hypo71file = '%s/PyLoT_%s_HYPO71_phases' % (event, evID)
|
hypo71file = '%s/PyLoT_%s_HYPO71_phases' % (event, evID)
|
||||||
hypo71.export(picks, hypo71file, parameter)
|
hypo71.export(picks, hypo71file, parameter)
|
||||||
|
@ -145,12 +145,13 @@ class Data(object):
|
|||||||
# handle forbidden filenames especially on windows systems
|
# handle forbidden filenames especially on windows systems
|
||||||
return fnConstructor(str(ID))
|
return fnConstructor(str(ID))
|
||||||
|
|
||||||
def exportEvent(self, fnout, fnext='.xml'):
|
def exportEvent(self, fnout, fnext='.xml', fcheck='auto'):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
:param fnout:
|
:param fnout:
|
||||||
:param fnext:
|
:param fnext:
|
||||||
|
:param fcheck:
|
||||||
:raise KeyError:
|
:raise KeyError:
|
||||||
"""
|
"""
|
||||||
from pylot.core.util.defaults import OUTPUTFORMATS
|
from pylot.core.util.defaults import OUTPUTFORMATS
|
||||||
@ -161,13 +162,35 @@ class Data(object):
|
|||||||
errmsg = '{0}; selected file extension {1} not ' \
|
errmsg = '{0}; selected file extension {1} not ' \
|
||||||
'supported'.format(e, fnext)
|
'supported'.format(e, fnext)
|
||||||
raise FormatError(errmsg)
|
raise FormatError(errmsg)
|
||||||
|
|
||||||
|
# check for already existing xml-file
|
||||||
|
if fnext == '.xml':
|
||||||
|
if os.path.isfile(fnout + fnext):
|
||||||
|
print("xml-file already exists! Check content ...")
|
||||||
|
cat_old = read_events(fnout + fnext)
|
||||||
|
checkflag = 0
|
||||||
|
for j in range(len(cat_old.events[0].picks)):
|
||||||
|
if cat_old.events[0].picks[j].method_id.id.split('/')[1] == fcheck:
|
||||||
|
print("Found %s pick(s), append to new catalog." % fcheck)
|
||||||
|
checkflag = 1
|
||||||
|
break
|
||||||
|
if checkflag == 1:
|
||||||
|
self.get_evt_data().write(fnout + fnext, format=evtformat)
|
||||||
|
cat_new = read_events(fnout + fnext)
|
||||||
|
cat_new.append(cat_old.events[0])
|
||||||
|
cat_new.write(fnout + fnext, format=evtformat)
|
||||||
|
else:
|
||||||
|
self.get_evt_data().write(fnout + fnext, format=evtformat)
|
||||||
|
else:
|
||||||
|
self.get_evt_data().write(fnout + fnext, format=evtformat)
|
||||||
|
|
||||||
# try exporting event via ObsPy
|
# try exporting event via ObsPy
|
||||||
try:
|
else:
|
||||||
self.get_evt_data().write(fnout + fnext, format=evtformat)
|
try:
|
||||||
except KeyError as e:
|
self.get_evt_data().write(fnout + fnext, format=evtformat)
|
||||||
raise KeyError('''{0} export format
|
except KeyError as e:
|
||||||
not implemented: {1}'''.format(evtformat, e))
|
raise KeyError('''{0} export format
|
||||||
|
not implemented: {1}'''.format(evtformat, e))
|
||||||
|
|
||||||
def getComp(self):
|
def getComp(self):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user