From 8e63fb9ef42dd05eb8c062343a2e29dd252ecc3f Mon Sep 17 00:00:00 2001 From: Christoph Knote <christoph.knote@med.uni-augsburg.de> Date: Wed, 30 Mar 2022 20:26:21 +0200 Subject: [PATCH] Make a copy of the data upon adding --- src/icartt/dataset.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/icartt/dataset.py b/src/icartt/dataset.py index 81e5a8c..6d3c7ce 100644 --- a/src/icartt/dataset.py +++ b/src/icartt/dataset.py @@ -87,18 +87,20 @@ class DataStore1001: """ if not isinstance(newData, np.ndarray): raise TypeError("Input data needs to be numpy ndarray.") - if newData.dtype.names is None: + + workData = newData.copy() + if workData.dtype.names is None: try: - newData.dtype = [(name, newData.dtype) for name in self.varnames] + workData.dtype = [(name, workData.dtype) for name in self.varnames] except: ValueError( "Could not assign names to data structure, are you providing an array containing all variables?" ) if self.data is None: - self.data = newData + self.data = workData else: - self.data = np.append(self.data, newData) + self.data = np.append(self.data, workData) def denanify(self, d): dd = d.copy() -- GitLab