WIP: Fix bug where perfectly aligning traces are merged into one trace by MSeed read routine#498
WIP: Fix bug where perfectly aligning traces are merged into one trace by MSeed read routine#498flixha wants to merge 7 commits intoeqcorrscan:developfrom
Conversation
Template-read: add check that mseed-routines didnot incorrectly merge traces.
|
This is a nice idea to cope with this, but frustratingly the lack of checks for short template lengths in other places can lead to some short traces being included in templates. This means that taking the minimum of the trace lengths to be the correct length probably won't work as a general fix. I wonder if it is time to add some more details to the template files that are written out, like the nominal length, or the start and end times of each channel in the template. It would also be good to catch the issue of incorrect template lengths on creation... |
|
I see that; I didn't fully think through that part about templates that are too short because I had my own checks in place while I was creating the templates. So this solution here won't work on its own for now.. |
|
Sadly no - I think that generating templates not of the length requested is a bug that should be fixed as well, but that still won't help with older templates, or templates that someone might have constructed not using EQcorrscan (once the bug is fixed). In another issue (I forget which, sorry), allowing different lengths on different channels has been discussed as well. Maybe we should just commit to fixing this by adding more metadata and forcibly reconstructing the waveforms to meet that metadata? |
What does this PR do?
First attempt at fixing #497. This checks that all template traces have the same length. If it finds any traces that have double (or another multiple) of the "normal" template length, then it splits these traces into traces of the exact same length with the newly corrected start and endtimes.
I will add testing / changes-log once I / we feel that this is the right way to avoid the bug.
Why was it initiated? Any relevant Issues?
The fix here keeps all the checks within EQcorrscan, while in theory I was hoping to find an option that avoids the behavior that leads to this bug in the mseed-routines. But I don't think that such an option exists there for exact matches; the only option I do know is that one case change a hard-coded option in the miniseed-library to reduce the tolerance until which traces are merged. But that only concerns the matching of time samples; not block numbers as far as I know.
As we don't (yet) save template length as a template / tribe metadata, the following edge cases would not be solved by this PR:
PR Checklist
developbase branch selected?CHANGES.md.[ ] First time contributors have added your name toCONTRIBUTORS.md.