Skip to content
Snippets Groups Projects
Commit 8ca4caf5 authored by Kien Le's avatar Kien Le
Browse files

Add explanation for code

parent 009e9266
No related branches found
No related tags found
1 merge request!280Optimize reading RT130 data
......@@ -89,8 +89,14 @@ class DecimatedReftek130(obspy_rt130_core.Reftek130):
if data[0]['data_format'] == b'16':
data_points = data['payload'][:, :2]
# The data is stored in a big-endian order.
# Merge the two bytes in each data point into a two-byte number.
data_points = data_points.view(np.dtype('>i2'))
data_points = data_points.astype(np.dtype('>i4')).view('>u1')
# Sign extend the two-byte numbers into four-byte numbers. This is
# done to match the byte length of other data formats.
data_points = data_points.astype(np.dtype('>i4'))
# Convert each four-byte number into four bytes to match Obspy's
# payload format.
data_points = data_points.view('>u1')
else:
if data[0]['data_format'] in [b'C0', b'C1', b'C2', b'C3']:
# The first 40 bytes in the payload are filler, so we skip past
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment