io.reftek: handle malformed EH packet sampling rate field gracefully#1
Open
athulpalliath wants to merge 2 commits into
Open
io.reftek: handle malformed EH packet sampling rate field gracefully#1athulpalliath wants to merge 2 commits into
athulpalliath wants to merge 2 commits into
Conversation
… add fallback_sampling_rate parameter for malformed EH headers Added fallback_sampling_rate parameter to handle cases where the sampling rate cannot be parsed from the EH packet. Updated relevant methods to utilize this new parameter.
Old REFTEK DAS firmware sometimes wrote blank or scrambled fields in the EH packet binary header. This adds a try/except around the converter call in EHPacket.__init__ so that malformed fields are set to None with a warning instead of raising ValueError and preventing the entire file from being read. This is part of the same fix as the core.py change - the two together allow reading of REFTEK files recorded with old firmware.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Old REFTEK DAS firmware sometimes wrote blank or scrambled
fields in the EH packet binary header, causing ObsPy to raise a
ValueError even though the DT packets containing actual waveform data
are intact.
This PR adds a fallback_sampling_rate parameter to _read_reftek130()
and to_stream() so users can specify the sampling rate when the EH
packet field cannot be parsed.
A separate fix for EHPacket.init (packet.py) to handle other
malformed fields will follow in a subsequent PR.