Use writephases for exporting to VELEST-input file, as VELEST can handle only 4-string station IDs which is already implemented in source code.
This commit is contained in:
parent
db628a5228
commit
9f48b23d88
@ -1149,7 +1149,7 @@ class MainWindow(QMainWindow):
|
||||
upperErrors=[uppererrorP[3], uppererrorS[3]])
|
||||
saved_as += str(outformat) + ' '
|
||||
except TypeError:
|
||||
print('WARNING: Format: {} not yet implemented'.format(outformat)) #MP MP TODO: .obs export (event.copy)
|
||||
print('WARNING: Format: {} not yet implemented'.format(outformat))
|
||||
|
||||
msg = 'Event {} saved as {} in format(s) {}'.format(event.pylot_id, fbasename, saved_as.strip())
|
||||
self.update_status(msg)
|
||||
|
@ -425,7 +425,7 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
|
||||
hyposat.export(picks, hyposatfile, parameter)
|
||||
# VELEST
|
||||
velestfile = '%s/PyLoT_%s_VELEST_phases.cnv' % (eventpath, evID)
|
||||
velest.export(picks, velestfile, parameter, evt)
|
||||
velest.export(picks, velestfile, evt, parameter)
|
||||
# hypoDD
|
||||
hypoddfile = '%s/PyLoT_%s_hypoDD_phases.pha' % (eventpath, evID)
|
||||
hypodd.export(picks, hypoddfile, parameter, evt)
|
||||
|
@ -13,6 +13,7 @@ from pylot.core.io.phases import readPILOTEvent, picks_from_picksdict, \
|
||||
from pylot.core.util.errors import FormatError, OverwriteError
|
||||
from pylot.core.util.event import Event
|
||||
from pylot.core.util.utils import fnConstructor, full_range
|
||||
import pylot.core.loc.velest as velest
|
||||
|
||||
|
||||
class Data(object):
|
||||
@ -223,8 +224,7 @@ class Data(object):
|
||||
self.checkEvent(event, fcheck)
|
||||
self.setEvtData(event)
|
||||
self.get_evt_data().write(fnout + fnext, format=evtformat)
|
||||
|
||||
# try exporting event via ObsPy
|
||||
# try exporting event
|
||||
else:
|
||||
evtdata_org = self.get_evt_data()
|
||||
picks = evtdata_org.picks
|
||||
@ -296,7 +296,7 @@ class Data(object):
|
||||
not implemented: {1}'''.format(evtformat, e))
|
||||
if fnext == '.cnv':
|
||||
try:
|
||||
evtdata_org.write(fnout + fnext, format=evtformat)
|
||||
velest.export(picks_copy, fnout + fnext, eventinfo=self.get_evt_data())
|
||||
except KeyError as e:
|
||||
raise KeyError('''{0} export format
|
||||
not implemented: {1}'''.format(evtformat, e))
|
||||
|
@ -403,7 +403,7 @@ def reassess_pilot_event(root_dir, db_dir, event_id, out_dir=None, fn_param=None
|
||||
# evt.write(fnout_prefix + 'cnv', format='VELEST')
|
||||
|
||||
|
||||
def writephases(arrivals, fformat, filename, parameter, eventinfo=None):
|
||||
def writephases(arrivals, fformat, filename, parameter=None, eventinfo=None):
|
||||
"""
|
||||
Function of methods to write phases to the following standard file
|
||||
formats used for locating earthquakes:
|
||||
@ -622,7 +622,11 @@ def writephases(arrivals, fformat, filename, parameter, eventinfo=None):
|
||||
fid = open("%s" % filename, 'w')
|
||||
# get informations needed in cnv-file
|
||||
# check, whether latitude is N or S and longitude is E or W
|
||||
try:
|
||||
eventsource = eventinfo.origins[0]
|
||||
except:
|
||||
print("No source origin calculated yet, thus no cnv-file creation possible!")
|
||||
return
|
||||
if eventsource['latitude'] < 0:
|
||||
cns = 'S'
|
||||
else:
|
||||
|
@ -7,7 +7,7 @@ from pylot.core.util.version import get_git_version as _getVersionString
|
||||
__version__ = _getVersionString()
|
||||
|
||||
|
||||
def export(picks, fnout, parameter, eventinfo):
|
||||
def export(picks, fnout, eventinfo, parameter=None):
|
||||
'''
|
||||
Take <picks> dictionary and exports picking data to a VELEST-cnv
|
||||
<phasefile> without creating an ObsPy event object.
|
||||
@ -18,11 +18,11 @@ def export(picks, fnout, parameter, eventinfo):
|
||||
:param fnout: complete path to the exporting obs file
|
||||
:type fnout: str
|
||||
|
||||
:param: parameter, all input information
|
||||
:type: object
|
||||
|
||||
:param: eventinfo, source time needed for VELEST-cnv format
|
||||
:type: list object
|
||||
|
||||
:param: parameter, all input information
|
||||
:type: object
|
||||
'''
|
||||
# write phases to VELEST-phase file
|
||||
writephases(picks, 'VELEST', fnout, parameter, eventinfo)
|
||||
|
Loading…
Reference in New Issue
Block a user