From 6777dfdf9dad0316d26d1623d76edcc4e7c28f0a Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Tue, 15 Mar 2022 11:17:17 +0100 Subject: [PATCH] Reorganise .dat files to lines --- swash/processing/read_swash.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/swash/processing/read_swash.py b/swash/processing/read_swash.py index 53c82a9..2eec6b5 100644 --- a/swash/processing/read_swash.py +++ b/swash/processing/read_swash.py @@ -13,11 +13,8 @@ class ReadSwash: @classmethod def read_nohead(cls, path): - with tempfile.TemporaryFile() as tmpfile: - with open(path) as file: - subprocess.run(("tr", "-d", "\n"), stdin=file, stdout=tmpfile) - tmpfile.seek(0) - return np.loadtxt(tmpfile) + subprocess.run(("sed", "-i", "s/ /\n/g", path)) + return np.loadtxt(path) def read_time(self, path): self._t = np.unique(self.read_nohead(path))