From d771514f5aa3431a4f2302830aceb3c555ddb547 Mon Sep 17 00:00:00 2001 From: Jeremy Fee <jmfee@usgs.gov> Date: Fri, 20 May 2016 11:30:00 -0600 Subject: [PATCH] Make IAGAWriter pad a copy of the channels list, instead of the original --- geomagio/iaga2002/IAGA2002Writer.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/geomagio/iaga2002/IAGA2002Writer.py b/geomagio/iaga2002/IAGA2002Writer.py index 10cec07de..b74bcc2be 100644 --- a/geomagio/iaga2002/IAGA2002Writer.py +++ b/geomagio/iaga2002/IAGA2002Writer.py @@ -37,7 +37,7 @@ class IAGA2002Writer(object): (channel, str(TimeseriesUtility.get_channels(timeseries)))) stats = timeseries[0].stats if len(channels) != 4: - self._pad_to_four_channels(timeseries, channels) + channels = self._pad_to_four_channels(timeseries, channels) out.write(self._format_headers(stats, channels)) out.write(self._format_comments(stats)) out.write(self._format_channels(channels, stats.station)) @@ -247,10 +247,12 @@ class IAGA2002Writer(object): for val in values]) def _pad_to_four_channels(self, timeseries, channels): + padded = channels[:] for x in range(len(channels), 4): channel = self.empty_channel - channels.append(channel) + padded.append(channel) timeseries += create_empty_trace(timeseries[0], channel) + return padded @classmethod def format(self, timeseries, channels): -- GitLab