[bugfix/test] idea to fix problem with different ressource_id's on autoPyLoT

This commit is contained in:
Marcel Paffrath 2017-07-10 17:37:54 +02:00
parent e0926c6b20
commit e3a4a2861d

View File

@ -8,6 +8,7 @@ import glob
import os import os
import datetime import datetime
from obspy import read_events from obspy import read_events
from obspy.core.event import ResourceIdentifier
import pylot.core.loc.hyposat as hyposat import pylot.core.loc.hyposat as hyposat
import pylot.core.loc.hypo71 as hypo71 import pylot.core.loc.hypo71 as hypo71
import pylot.core.loc.velest as velest import pylot.core.loc.velest as velest
@ -24,6 +25,7 @@ from pylot.core.util.dataprocessing import restitute_data, read_metadata, \
remove_underscores remove_underscores
from pylot.core.util.structure import DATASTRUCTURE from pylot.core.util.structure import DATASTRUCTURE
from pylot.core.util.version import get_git_version as _getVersionString from pylot.core.util.version import get_git_version as _getVersionString
from pylot.core.util.event import Event
__version__ = _getVersionString() __version__ = _getVersionString()
@ -160,6 +162,8 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
return return
for event in events: for event in events:
pylot_event = Event(event) #event should be path to event directory
data.setEvtData(pylot_event)
if fnames == 'None': if fnames == 'None':
data.setWFData(glob.glob(os.path.join(datapath, event, '*'))) data.setWFData(glob.glob(os.path.join(datapath, event, '*')))
evID = os.path.split(event)[-1] evID = os.path.split(event)[-1]
@ -352,6 +356,8 @@ def autoPyLoT(input_dict=None, parameter=None, inputfile=None, fnames=None, even
# ObsPy event object # ObsPy event object
data.applyEVTData(picks) data.applyEVTData(picks)
if evt is not None: if evt is not None:
event_id = event.split('/')[-1]
evt.resource_id = ResourceIdentifier('smi:local/' + event_id)
data.applyEVTData(evt, 'event') data.applyEVTData(evt, 'event')
fnqml = '%s/PyLoT_%s' % (event, evID) fnqml = '%s/PyLoT_%s' % (event, evID)
data.exportEvent(fnqml, fnext='.xml', fcheck='manual') data.exportEvent(fnqml, fnext='.xml', fcheck='manual')