From ba169fb85b9afa0948a134d8066d3f3188d3f486 Mon Sep 17 00:00:00 2001
From: kienle <kienle@passcal.nmt.edu>
Date: Wed, 2 Aug 2023 16:49:28 -0600
Subject: [PATCH] Change how sizes of traces are determined

---
 sohstationviewer/model/handling_data.py | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/sohstationviewer/model/handling_data.py b/sohstationviewer/model/handling_data.py
index 2092766e4..98f327410 100644
--- a/sohstationviewer/model/handling_data.py
+++ b/sohstationviewer/model/handling_data.py
@@ -349,7 +349,10 @@ def read_mseed_trace_spr_less_than_or_equal_1(trace: Trace) -> Dict:
     tr['startTmEpoch'] = trace.stats.starttime.timestamp
     tr['endTmEpoch'] = trace.stats.endtime.timestamp
     tr['samplerate'] = trace.stats.sampling_rate
-    tr['size'] = trace.stats.npts
+    if hasattr(trace.stats, 'actual_npts'):
+        tr['size'] = trace.stats.actual_npts
+    else:
+        tr['size'] = trace.stats.npts
     """
     trace time start with 0 => need to add with epoch starttime
     times and data have type ndarray
@@ -388,7 +391,10 @@ def read_mseed_trace_spr_greater_than_1(
     tr['samplerate'] = trace.stats.sampling_rate
     tr['startTmEpoch'] = trace.stats['starttime'].timestamp
     tr['endTmEpoch'] = trace.stats['endtime'].timestamp
-    tr['size'] = trace.stats.npts
+    if hasattr(trace.stats, 'actual_npts'):
+        tr['size'] = trace.stats.actual_npts
+    else:
+        tr['size'] = trace.stats.npts
     if trace.stats.channel.startswith('MassPos'):
         data = convert_reftek_masspos_data(trace.data)
     else:
-- 
GitLab