Skip to content

Commit

Permalink
fix indexing of waveform files with duplicated traces
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Tremor committed Aug 21, 2018
1 parent 7322d77 commit fccfcaf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/jane/waveforms/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit fccfcaf

Please sign in to comment.