[update] merging picks in Data updated

This commit is contained in:
Marcel Paffrath 2019-03-12 15:15:48 +01:00
parent ea07823a61
commit a8db13095e

View File

@ -86,9 +86,17 @@ class Data(object):
if other.isNew() and not self.isNew(): if other.isNew() and not self.isNew():
picks_to_add = other.get_evt_data().picks picks_to_add = other.get_evt_data().picks
old_picks = self.get_evt_data().picks old_picks = self.get_evt_data().picks
for pick in picks_to_add: wf_ids_old = [pick.waveform_id for pick in old_picks]
if pick not in old_picks: for new_pick in picks_to_add:
old_picks.append(pick) wf_id = new_pick.waveform_id
if wf_id in wf_ids_old:
for old_pick in old_picks:
comparison = [old_pick.waveform_id == new_pick.waveform_id,
old_pick.phase_hint == new_pick.phase_hint,
old_pick.method_id == new_pick.method_id]
if all(comparison):
del(old_pick)
old_picks.append(new_pick)
elif not other.isNew() and self.isNew(): elif not other.isNew() and self.isNew():
new = other + self new = other + self
self.evtdata = new.get_evt_data() self.evtdata = new.get_evt_data()