From c11f3048fdeb37f5a2915a93e570833dcb801bde Mon Sep 17 00:00:00 2001 From: Marcus Herrmann <marcus.herrmann@sed.ethz.ch> Date: Wed, 22 Feb 2017 17:46:49 +0100 Subject: [PATCH] Improved fix of MSEED writing crashes (ef1fa318, 41efe582) based on empirical trial and error: libmseed w/ STEIM2 encoding crashes when the diff b/w two values is larger than 536870911 (a quarter of the maximum value of the int32 dtype) --- TM/io.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TM/io.py b/TM/io.py index f744caa..8b05f42 100644 --- a/TM/io.py +++ b/TM/io.py @@ -1118,7 +1118,7 @@ def preload_chunk(chunkId, chunkTime, chunkLength, raw=True, processed=True, std for tr in chunkStream: # Check if there are STEIM2-incompatible values - diff_limit = np.iinfo(np.int32).max + diff_limit = np.iinfo(np.int32).max // 4 if np.abs(np.diff(tr.data.astype(np.float32))).max() >= diff_limit: encoding = 'STEIM1' # or INT32, or FLOAT32 break # Don't test the other traces -- GitLab