[closes #137] location out of QtPyLoT now possible
This commit is contained in:
parent
ad91504211
commit
280e954cac
@ -1,6 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import copy
|
||||
import glob
|
||||
import os
|
||||
from obspy import read_events, read_inventory
|
||||
@ -434,6 +435,7 @@ class Data(object):
|
||||
#firstonset = find_firstonset(picks)
|
||||
if self.getEvtData().picks:
|
||||
raise OverwriteError('Actual picks would be overwritten!')
|
||||
else:
|
||||
picks = picks_from_picksdict(picks)
|
||||
self.getEvtData().picks = picks
|
||||
# if 'smi:local' in self.getID() and firstonset:
|
||||
@ -443,25 +445,22 @@ class Data(object):
|
||||
# self.getEvtData().resource_id = ID
|
||||
|
||||
|
||||
def applyArrivals(arrivals):
|
||||
"""
|
||||
|
||||
:param arrivals:
|
||||
"""
|
||||
pass
|
||||
|
||||
def applyEvent(event):
|
||||
"""
|
||||
|
||||
takes an `obspy.core.event.Event` object and applies all new
|
||||
information on the event to the actual data
|
||||
:param event:
|
||||
"""
|
||||
if not self.isNew():
|
||||
self.setEvtData(event)
|
||||
else:
|
||||
raise OverwriteError('Acutal event would be overwritten!')
|
||||
# prevent overwriting uncertainty information
|
||||
picks = copy.deepcopy(self.getEvtData().picks)
|
||||
event.picks = picks
|
||||
# apply event information from location
|
||||
self.getEvtData().update(event)
|
||||
|
||||
applydata = {'pick': applyPicks,
|
||||
'arrival': applyArrivals,
|
||||
'event': applyEvent}
|
||||
|
||||
applydata[type](data)
|
||||
|
@ -92,7 +92,7 @@ def read_location(fn):
|
||||
if len(file) > 1:
|
||||
raise IOError('ambiguous location name {0}'.format(file))
|
||||
fn = os.path.join(path, file[0])
|
||||
return read_events(fn)
|
||||
return read_events(fn)[0]
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user