From 280e954cac0919c77aa348ead2af588071a4a15c Mon Sep 17 00:00:00 2001 From: Sebastianw Wehling-Benatelli Date: Tue, 30 Aug 2016 14:53:58 +0200 Subject: [PATCH] [closes #137] location out of QtPyLoT now possible --- pylot/core/io/data.py | 21 ++++++++++----------- pylot/core/loc/nll.py | 2 +- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/pylot/core/io/data.py b/pylot/core/io/data.py index 71c6371e..1f4a6008 100644 --- a/pylot/core/io/data.py +++ b/pylot/core/io/data.py @@ -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,7 +435,8 @@ class Data(object): #firstonset = find_firstonset(picks) if self.getEvtData().picks: raise OverwriteError('Actual picks would be overwritten!') - picks = picks_from_picksdict(picks) + else: + picks = picks_from_picksdict(picks) self.getEvtData().picks = picks # if 'smi:local' in self.getID() and firstonset: # fonset_str = firstonset.strftime('%Y_%m_%d_%H_%M_%S') @@ -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) diff --git a/pylot/core/loc/nll.py b/pylot/core/loc/nll.py index 5cc0c647..f9b36e76 100644 --- a/pylot/core/loc/nll.py +++ b/pylot/core/loc/nll.py @@ -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__':