1
Fork 0

Fixed multiproc

This commit is contained in:
Edgar P. Burkhart 2022-03-15 11:45:29 +01:00
parent 2acb5f9f17
commit e62bb932c6
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}'")
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(),
)