From 52d6718d704d013b7f13df9351856797e62ac5c0 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Tue, 29 Mar 2022 15:34:26 +0200 Subject: [PATCH] Minor tweaks to swash post-processing --- swash/processing/animate.py | 2 +- swash/processing/layers.py | 2 +- swash/processing/read_swash.py | 2 +- swash/processing/sws_npz.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/swash/processing/animate.py b/swash/processing/animate.py index 1162399..2717140 100644 --- a/swash/processing/animate.py +++ b/swash/processing/animate.py @@ -22,7 +22,7 @@ config.read(args.config) inp = pathlib.Path(config.get("post", "inp")) root = pathlib.Path(config.get("swash", "out")) out = pathlib.Path(config.get("plot", "out")) -out.mkdir(exist_ok=True) +out.mkdir(parents=True, exist_ok=True) def data(var): diff --git a/swash/processing/layers.py b/swash/processing/layers.py index e2d2f05..81c8f83 100644 --- a/swash/processing/layers.py +++ b/swash/processing/layers.py @@ -22,7 +22,7 @@ config.read(args.config) inp = pathlib.Path(config.get("post", "inp")) root = pathlib.Path(config.get("swash", "out")) out = pathlib.Path(config.get("plot", "out")) -out.mkdir(exist_ok=True) +out.mkdir(parents=True, exist_ok=True) def data(var): diff --git a/swash/processing/read_swash.py b/swash/processing/read_swash.py index 8a983b7..8197bca 100644 --- a/swash/processing/read_swash.py +++ b/swash/processing/read_swash.py @@ -13,7 +13,7 @@ class ReadSwash: @classmethod def read_nohead(cls, path): - subprocess.run(("sed", "-i", r"s/ /\n/g", path)) + subprocess.run(("sed", "-i", r"s/\s\+/\n/g", path)) return np.loadtxt(path) def read_time(self, path): diff --git a/swash/processing/sws_npz.py b/swash/processing/sws_npz.py index 3c971ab..31a1f5e 100644 --- a/swash/processing/sws_npz.py +++ b/swash/processing/sws_npz.py @@ -40,7 +40,7 @@ var = { } inp.mkdir(exist_ok=True) -with ThreadPool() as pool: +with ThreadPool(len(var)) as pool: log.info("Converting all data") pool.map( lambda x: np.save(