fixing import problems

This commit is contained in:
Sebastian Wehling-Benatelli 2016-05-03 15:09:51 +02:00
parent 41991c5d81
commit fd27a43110
2 changed files with 14 additions and 6 deletions

View File

@ -10,8 +10,7 @@ from obspy.core import UTCDateTime
from pylot.core.pick.utils import select_for_phase from pylot.core.pick.utils import select_for_phase
from pylot.core.util.utils import getOwner, createPick, createArrival, \ from pylot.core.util.utils import getOwner, createPick, createArrival, \
createEvent, createOrigin, createMagnitude createEvent, createOrigin, createMagnitude, getGlobalTimes
from pylot.core.util.defaults import AUTOMATIC_DEFAULTS
def readPILOTEvent(phasfn=None, locfn=None, authority_id=None, **kwargs): def readPILOTEvent(phasfn=None, locfn=None, authority_id=None, **kwargs):
""" """
@ -268,12 +267,16 @@ def picks_from_picksdict(picks):
return picks_list return picks_list
def reassess_pilot_event(root_dir, event_id, fn_param=AUTOMATIC_DEFAULTS): def reassess_pilot_event(root_dir, event_id, fn_param=None):
from obspy import read from obspy import read
from pylot.core.io.inputs import AutoPickParameter from pylot.core.io.inputs import AutoPickParameter
from pylot.core.pick.utils import earllatepicker from pylot.core.pick.utils import earllatepicker
if fn_param is None:
import pylot.core.util.defaults as defaults
fn_param = defaults.AUTOMATIC_DEFAULTS
default = AutoPickParameter(fn_param) default = AutoPickParameter(fn_param)
search_base = os.path.join(root_dir, event_id) search_base = os.path.join(root_dir, event_id)
@ -297,11 +300,16 @@ def reassess_pilot_event(root_dir, event_id, fn_param=AUTOMATIC_DEFAULTS):
print(e.message, station) print(e.message, station)
continue continue
sel_st = select_for_phase(st, phase) sel_st = select_for_phase(st, phase)
stime, etime = getGlobalTimes(sel_st)
rel_pick = mpp - stime
epp, lpp, spe = earllatepicker(sel_st, epp, lpp, spe = earllatepicker(sel_st,
default.get('nfac{0}'.format(phase)), default.get('nfac{0}'.format(phase)),
default.get('tsnrz' if phase == 'P' else 'tsnrh'), default.get('tsnrz' if phase == 'P' else 'tsnrh'),
mpp, None, True Pick1=rel_pick,
iplot=None,
) )
epp = stime + epp
lpp = stime + lpp
picks_dict[station][phase] = dict(epp=epp, mpp=mpp, lpp=lpp, spe=spe) picks_dict[station][phase] = dict(epp=epp, mpp=mpp, lpp=lpp, spe=spe)
# create Event object for export # create Event object for export
evt = ope.Event(resource_id=event_id) evt = ope.Event(resource_id=event_id)

View File

@ -479,12 +479,12 @@ def select_for_phase(st, phase):
from pylot.core.util.defaults import COMPNAME_MAP from pylot.core.util.defaults import COMPNAME_MAP
sel_st = Stream() sel_st = Stream()
if phase.upper() is 'P': if phase.upper() == 'P':
comp = 'Z' comp = 'Z'
alter_comp = COMPNAME_MAP[comp] alter_comp = COMPNAME_MAP[comp]
sel_st += st.select(component=comp) sel_st += st.select(component=comp)
sel_st += st.select(component=alter_comp) sel_st += st.select(component=alter_comp)
elif phase.upper() is 'S': elif phase.upper() == 'S':
comps = 'NE' comps = 'NE'
for comp in comps: for comp in comps:
alter_comp = COMPNAME_MAP[comp] alter_comp = COMPNAME_MAP[comp]