obspy.io.reftek.packet._unpack_C0_C2_data_fast

_unpack_C0_C2_data_fast(packets, encoding)[source]

Unpacks sample data from a packet array that uses ‘C0’ or ‘C2’ data encoding.

Unfortunately the whole data cannot be unpacked with one call to libmseed as some payloads do not take the full 960 bytes. They are thus padded which would results in padded pieces directly in a large array and libmseed (understandably) does not support that.

Thus we resort to tada pointer arithmetics in Python ;-) This is quite a bit faster then correctly casting to an integer pointer so it’s worth it.

Also avoid a data copy.

Writing this directly in C would be about 3 times as fast so it might be worth it.

Parameters:
  • packets (numpy.ndarray (dtype PACKET_FINAL_DTYPE)) Array of data packets (packet_type 'DT') from which to unpack the sample data (with data encoding ‘C0’ or ‘C2’).
  • encoding (str) Reftek data encoding as specified in event header (EH) packet, either 'C0' or 'C2'.