From c9b1546e9cf2ff499c1963a3e93d0f16dcbf2c84 Mon Sep 17 00:00:00 2001
From: "Erin (Josh) Rigler" <erigler@igskcicgltgm017.cr.usgs.gov>
Date: Wed, 22 Aug 2018 15:39:15 -0600
Subject: [PATCH] Work-around for issue #216

ObsPy/NumPy have a bug related to masked arrays that this small
change works around by forcing gaps to be filled by NaNs, even
during intermediate processing.
---
 geomagio/TimeseriesUtility.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/geomagio/TimeseriesUtility.py b/geomagio/TimeseriesUtility.py
index 7fe24886..e82ab8d7 100644
--- a/geomagio/TimeseriesUtility.py
+++ b/geomagio/TimeseriesUtility.py
@@ -223,7 +223,9 @@ def merge_streams(*streams):
             # 1 = do not interpolate
             interpolation_samples=0,
             # 1 = when there is overlap, use data from trace with last endtime
-            method=1)
+            method=1,
+            # np.nan = work-around for (problematic) intermediate masked arrays
+            filled_value=numpy.nan)
 
     # convert back to NaN filled array
     merged = unmask_stream(split)
-- 
GitLab