[enhancement, task] there was no routine to read obs pick files available; default values for autopicking should be the same for all parts of PyLoT, thus defaults should be defined only once
This commit is contained in:
parent
2a8729c39b
commit
a9cd53886b
@ -45,7 +45,8 @@ from pylot.core.read.inputs import FilterOptions, AutoPickParameter
|
|||||||
from pylot.core.pick.autopick import autopickevent
|
from pylot.core.pick.autopick import autopickevent
|
||||||
from pylot.core.read.io import picks_from_evt
|
from pylot.core.read.io import picks_from_evt
|
||||||
from pylot.core.loc.nll import locate as locateNll
|
from pylot.core.loc.nll import locate as locateNll
|
||||||
from pylot.core.util.defaults import FILTERDEFAULTS, COMPNAME_MAP
|
from pylot.core.util.defaults import FILTERDEFAULTS, COMPNAME_MAP,\
|
||||||
|
AUTOMATIC_DEFAULTS
|
||||||
from pylot.core.util.errors import FormatError, DatastructureError, \
|
from pylot.core.util.errors import FormatError, DatastructureError, \
|
||||||
OverwriteError
|
OverwriteError
|
||||||
from pylot.core.util.connection import checkurl
|
from pylot.core.util.connection import checkurl
|
||||||
@ -689,8 +690,7 @@ class MainWindow(QMainWindow):
|
|||||||
self.logDockWidget.setWidget(self.listWidget)
|
self.logDockWidget.setWidget(self.listWidget)
|
||||||
self.addDockWidget(Qt.LeftDockWidgetArea, self.logDockWidget)
|
self.addDockWidget(Qt.LeftDockWidgetArea, self.logDockWidget)
|
||||||
self.addListItem('loading default values for local data ...')
|
self.addListItem('loading default values for local data ...')
|
||||||
home = os.path.expanduser("~")
|
autopick_parameter = AutoPickParameter(AUTOMATIC_DEFAULTS)
|
||||||
autopick_parameter = AutoPickParameter('%s/.pylot/autoPyLoT_local.in' % home)
|
|
||||||
self.addListItem(str(autopick_parameter))
|
self.addListItem(str(autopick_parameter))
|
||||||
|
|
||||||
# Create the worker thread and run it
|
# Create the worker thread and run it
|
||||||
|
@ -135,6 +135,24 @@ def readPILOTEvent(phasfn=None, locfn=None, authority_id=None, **kwargs):
|
|||||||
raise AttributeError('{0} - Matlab LOC files {1} and {2} contains \
|
raise AttributeError('{0} - Matlab LOC files {1} and {2} contains \
|
||||||
insufficient data!'.format(e, phasfn, locfn))
|
insufficient data!'.format(e, phasfn, locfn))
|
||||||
|
|
||||||
|
def picks_from_obs(fn):
|
||||||
|
picks = dict()
|
||||||
|
station_name = str()
|
||||||
|
for line in open(fn, 'r'):
|
||||||
|
if line.startswith('#'):
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
phase_line = line.split()
|
||||||
|
if not station_name == phase_line[0]:
|
||||||
|
phase = dict()
|
||||||
|
station_name = phase_line[0]
|
||||||
|
phase_name = phase_line[4].upper()
|
||||||
|
pick = UTCDateTime(phase_line[6] + phase_line[7] + phase_line[8])
|
||||||
|
phase[phase_name] = dict(mpp=pick, fm=phase_line[5])
|
||||||
|
picks[station_name] = phase
|
||||||
|
return picks
|
||||||
|
|
||||||
|
|
||||||
def picks_from_evt(evt):
|
def picks_from_evt(evt):
|
||||||
'''
|
'''
|
||||||
Takes an Event object and return the pick dictionary commonly used within
|
Takes an Event object and return the pick dictionary commonly used within
|
||||||
@ -170,4 +188,4 @@ def picks_from_evt(evt):
|
|||||||
|
|
||||||
onsets[pick.phase_hint] = phase.copy()
|
onsets[pick.phase_hint] = phase.copy()
|
||||||
picks[station] = onsets.copy()
|
picks[station] = onsets.copy()
|
||||||
return picks
|
return picks
|
||||||
|
@ -43,6 +43,10 @@ FILTERDEFAULTS = readFilterInformation(os.path.join(os.path.expanduser('~'),
|
|||||||
'.pylot',
|
'.pylot',
|
||||||
'filter.in'))
|
'filter.in'))
|
||||||
|
|
||||||
|
AUTOMATIC_DEFAULTS = os.path.join(os.path.expanduser('~'),
|
||||||
|
'.pylot',
|
||||||
|
'autoPyLoT.in')
|
||||||
|
|
||||||
OUTPUTFORMATS = {'.xml': 'QUAKEML',
|
OUTPUTFORMATS = {'.xml': 'QUAKEML',
|
||||||
'.cnv': 'CNV',
|
'.cnv': 'CNV',
|
||||||
'.obs': 'NLLOC_OBS'}
|
'.obs': 'NLLOC_OBS'}
|
||||||
|
Loading…
Reference in New Issue
Block a user