From e62bb932c645b4b881000970eb8bc218e9dcefb1 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Tue, 15 Mar 2022 11:45:29 +0100 Subject: [PATCH] Fixed multiproc --- swash/processing/sws_npz.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/swash/processing/sws_npz.py b/swash/processing/sws_npz.py index 06c02c6..d17c493 100644 --- a/swash/processing/sws_npz.py +++ b/swash/processing/sws_npz.py @@ -25,8 +25,8 @@ inp = pathlib.Path(config.get("post", "inp")) log.info(f"Reading swash output from '{sws_out}'") rsws = ReadSwash() -rsws.read_time(sws_out.joinpath("tsec.dat")) -rsws.read_x(sws_out.joinpath("xp.dat")) +np.save(inp.joinpath("tsec"), rsws.read_time(sws_out.joinpath("tsec.dat"))) +np.save(inp.joinpath("xp"), rsws.read_x(sws_out.joinpath("xp.dat"))) var = { "dep": rsws.read_scalar, @@ -40,9 +40,10 @@ var = { inp.mkdir(exist_ok=True) with Pool() as pool: + log.info("Converting all data") pool.map( - lambda name, f: np.save( - inp.joinpath(name), f(sws_out.joinpath(name).with_suffix(".dat")) + lambda x: np.save( + inp.joinpath(x[0]), x[1](sws_out.joinpath(x[0]).with_suffix(".dat")) ), var.items(), )