From fccfcaf8f92bb86f5baa630153a5b0824cdd1e6f Mon Sep 17 00:00:00 2001 From: Tremor Date: Tue, 21 Aug 2018 15:28:36 +0200 Subject: [PATCH] fix indexing of waveform files with duplicated traces before, indexing failed if a file contained at least one duplicated trace, i.e. two traces with exactly the same NSLC and start/endtime. this happens sometimes in real life during data retrieval glitches (e.g. two slarchive threads running at same time by mistake). the database layout has to be changed, so that the Trace's position in the indexed file (field "pos") is included in the unique constraint of the waveform trace table. --- src/jane/waveforms/models.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/jane/waveforms/models.py b/src/jane/waveforms/models.py index caae726..7fedcfa 100644 --- a/src/jane/waveforms/models.py +++ b/src/jane/waveforms/models.py @@ -102,8 +102,8 @@ def __str__(self): class Meta: ordering = ['-timerange', 'network', 'station', 'location', 'channel'] - unique_together = ['file', 'network', 'station', 'location', 'channel', - 'timerange'] + unique_together = ['file', 'pos', 'network', 'station', 'location', + 'channel', 'timerange'] def timed_preview_trace(self): num_samples = (len(self.preview_trace) - 1)