From c97edc6b86ec7bb70807e4163dfe059b7211dea6 Mon Sep 17 00:00:00 2001
From: kienle <kienle@passcal.nmt.edu>
Date: Wed, 2 Aug 2023 15:50:48 -0600
Subject: [PATCH] Save times in trace

---
 sohstationviewer/model/reftek/from_rt2ms/core.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/sohstationviewer/model/reftek/from_rt2ms/core.py b/sohstationviewer/model/reftek/from_rt2ms/core.py
index cb612498f..a24d316d7 100644
--- a/sohstationviewer/model/reftek/from_rt2ms/core.py
+++ b/sohstationviewer/model/reftek/from_rt2ms/core.py
@@ -24,6 +24,12 @@ from sohstationviewer.model.reftek.from_rt2ms import packet
 from sohstationviewer.model.reftek.from_rt2ms.soh_packet import Packet
 
 
+class DiscontinuousTrace(Trace):
+    def __init__(self, *args, times, **kwargs):
+        super().__init__(**kwargs)
+        self.times = times
+
+
 eh_et_payload_last_field_start = 88
 eh_et_payload_last_field_size = 16
 
@@ -199,8 +205,10 @@ class Reftek130(obspy_rt130_core.Reftek130):
                         sample_data = (packets_['payload'][:, :4])
                         sample_data = sample_data.view(np.dtype('>i4')).squeeze()
                         npts = len(sample_data)
-
-                    tr = Trace(data=sample_data, header=copy.deepcopy(header))
+                    tr = DiscontinuousTrace(
+                        data=sample_data, header=copy.deepcopy(header),
+                        times=packets_['time']
+                    )
                     tr.stats.npts = packets_['number_of_samples'].sum()
                     tr.stats.actual_npts = npts
                     # channel number is not included in the EH/ET packet
-- 
GitLab