1
Fork 0

Fixed multiproc

This commit is contained in:
Edgar P. Burkhart 2022-03-15 11:45:29 +01:00
parent 441eec78d4
commit 5a9e5eb5b4
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227

View file

@ -25,8 +25,8 @@ inp = pathlib.Path(config.get("post", "inp"))
log.info(f"Reading swash output from '{sws_out}'") log.info(f"Reading swash output from '{sws_out}'")
rsws = ReadSwash() rsws = ReadSwash()
rsws.read_time(sws_out.joinpath("tsec.dat")) np.save(inp.joinpath("tsec"), rsws.read_time(sws_out.joinpath("tsec.dat")))
rsws.read_x(sws_out.joinpath("xp.dat")) np.save(inp.joinpath("xp"), rsws.read_x(sws_out.joinpath("xp.dat")))
var = { var = {
"dep": rsws.read_scalar, "dep": rsws.read_scalar,
@ -40,9 +40,10 @@ var = {
inp.mkdir(exist_ok=True) inp.mkdir(exist_ok=True)
with Pool() as pool: with Pool() as pool:
log.info("Converting all data")
pool.map( pool.map(
lambda name, f: np.save( lambda x: np.save(
inp.joinpath(name), f(sws_out.joinpath(name).with_suffix(".dat")) inp.joinpath(x[0]), x[1](sws_out.joinpath(x[0]).with_suffix(".dat"))
), ),
var.items(), var.items(),
) )