From 535235766e721f85481c295a070702714d35cc5d Mon Sep 17 00:00:00 2001 From: kienle <kienle@passcal.nmt.edu> Date: Tue, 25 Jul 2023 12:33:27 -0600 Subject: [PATCH] Fix plotting waveform data for RT130 data --- .../model/reftek/rt130_experiment/reftek.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sohstationviewer/model/reftek/rt130_experiment/reftek.py b/sohstationviewer/model/reftek/rt130_experiment/reftek.py index 02e9ba639..79e889326 100644 --- a/sohstationviewer/model/reftek/rt130_experiment/reftek.py +++ b/sohstationviewer/model/reftek/rt130_experiment/reftek.py @@ -76,7 +76,7 @@ def get_rt130_packet_header(rt130_packet: bytes, print_error('The given file does not appear to be a valid RT130 file.') raise RT130ParseError - experiment_number = unpacker.unpack('b', rt130_packet[2:3])[0] + experiment_number = int(rt130_packet[2:3].hex()) year = int(rt130_packet[3:4].hex()) # A call to str.upper() is needed because bytes.hex() makes any # hexadecimal letter (i.e. ABCDEF) lowercase, while we want them to be @@ -95,9 +95,9 @@ def read_rt130_file(file_name: str, unpacker: Unpacker): # RT130 data looks to be all big-endian (logpeek assumes this, and it has # been working pretty well), so we don't have to do any endianness check. - if os.path.getsize(file_name) % 1024: - warnings.warn('The size of the data is not a multiple of 1024; it ' - 'might be truncated.') + # if os.path.getsize(file_name) % 1024: + # warnings.warn('The size of the data is not a multiple of 1024; it ' + # 'might be truncated.') packets = [] @@ -199,7 +199,7 @@ class Reftek130(core.Reftek130): for packet in packets_in_file: converted_packets.append( convert_packet_to_obspy_format(packet, rt130_unpacker)) - rt._data = numpy.array(converted_packets, PACKET_FINAL_DTYPE) + rt._data = numpy.array(converted_packets, dtype=PACKET_FINAL_DTYPE) return rt @@ -207,5 +207,5 @@ waveform_file = '/Users/kle/PycharmProjects/sohstationviewer/tests/test_data/RT1 soh_file = '/Users/kle/PycharmProjects/sohstationviewer/tests/test_data/RT130-sample/2017149.92EB/2017150/92EB/0/000000000_00000000' import time start = time.perf_counter() -print((Reftek130.from_file(soh_file)._data)) -print('Time taken:', time.perf_counter() - start) +print(repr(Reftek130.from_file(waveform_file)._data)) +# print('Time taken:', time.perf_counter() - start) -- GitLab