uafgeotools / waveform_collection

Collect seismic/infrasound waveforms and metadata from IRIS/WATC/AVO servers, local miniSEED files, etc.
https://uaf-waveform-collection.readthedocs.io/
MIT License
13 stars 7 forks source link

Fix issue during merge when Trace dtypes are not all identical #24

Closed liamtoney closed 2 years ago

liamtoney commented 2 years ago

If ObsPy finds that Traces with the same ID have different data types, it will raise an exception:

Can't merge traces with same ids but differing data types!

This PR implements a "safe merge" where we try to merge as usual and then if that fails, we change all data types that aren't int32 to int32.


Note that a similar procedure could be done to avoid inconsistent sampling rate issues, such as those encountered in https://github.com/uafgeotools/rtm/issues/58#issuecomment-948053840. This could be accomplished via rounding, as in @awech's code here (from which this fix is based). That should be a separate PR though I think.

liamtoney commented 2 years ago

John Lyons is testing this fix on a use case that was failing for him, FWIW

liamtoney commented 2 years ago

John Lyons is testing this fix on a use case that was failing for him, FWIW

And it sounds like it passed that test.