Miniseed file crashes obspy

Hi all,

the miniseed file available under the following link crashes obspy with a segmentation fault, as soon as you try to write it with STEIM2 encoding:

https://www.polybox.ethz.ch/index.php/s/EoJVvPYLFcg2NhJ

As you can see when you plot the data, there is a huge spike with a difference larger than 2**30 in the signal which probably causes the crash.

Hi Roman,

this has been fixed here: https://github.com/obspy/obspy/pull/1658

Fixed in the sense that it now returns a nice error message:

  File "/Users/lion/workspace/code/obspy/obspy/core/stream.py", line
1442, in write
    write_format(self, filename, **kwargs)
  File "/Users/lion/workspace/code/obspy/obspy/io/mseed/core.py", line
922, in _write_mseed
    C.byref(packedsamples), flush, verbose, msr) # NOQA
  File "/Users/lion/workspace/code/obspy/obspy/io/mseed/headers.py",
line 833, in _wrapper
    raise InternalMSEEDError(msg)
obspy.io.mseed.InternalMSEEDError: Encountered 2 error(s) during a call
to mst_pack():
msr_encode_steim2(8X_CA04A__HHE_D): Unable to represent difference in <=
30 bits
msr_pack(8X_CA04A__HHE_D): Error packing data samples

STEIM2 can just not store data with spikes of this magnitude.

Cheers!

Lion