From 40f25644c9e334a18efb9d6970563892a53b44dc Mon Sep 17 00:00:00 2001
From: Eddie McWhirter <emcwhirter@usgs.gov>
Date: Fri, 26 Jun 2015 09:52:00 -0600
Subject: [PATCH] Use a copy of the trace instead of the original for
 formatting output.

---
 geomagio/pcdcp/PCDCPWriter.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/geomagio/pcdcp/PCDCPWriter.py b/geomagio/pcdcp/PCDCPWriter.py
index 5ade04613..facb92d78 100644
--- a/geomagio/pcdcp/PCDCPWriter.py
+++ b/geomagio/pcdcp/PCDCPWriter.py
@@ -71,11 +71,15 @@ class PCDCPWriter(object):
         """
         buf = []
 
-        if timeseries.select(channel='D'):
-            d = timeseries.select(channel='D')
+        # Use a copy of the trace so that we don't modify the original.
+        timeseriesLocal = timeseries.copy()
+
+        # move the int(round(val*100)) into here, numpy.round(numpy.multiply(trace, 100))
+        if timeseriesLocal.select(channel='D'):
+            d = timeseriesLocal.select(channel='D')
             d[0].data = ChannelConverter.get_minutes_from_radians(d[0].data)
 
-        traces = [timeseries.select(channel=c)[0] for c in channels]
+        traces = [timeseriesLocal.select(channel=c)[0] for c in channels]
         starttime = float(traces[0].stats.starttime)
         delta = traces[0].stats.delta
 
-- 
GitLab