Switched to new storage convention for swash output in sws_ola
This commit is contained in:
parent
b557712372
commit
71049d49ea
63 changed files with 174 additions and 5717 deletions
|
|
@ -1,51 +1,3 @@
|
|||
import argparse
|
||||
import configparser
|
||||
import logging
|
||||
import pathlib
|
||||
from multiprocessing.pool import ThreadPool
|
||||
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
|
||||
from .read_swash import ReadSwash
|
||||
|
||||
parser = argparse.ArgumentParser(description="Convert swash output to numpy")
|
||||
parser.add_argument("-v", "--verbose", action="count", default=0)
|
||||
args = parser.parse_args()
|
||||
|
||||
logging.basicConfig(level=max((10, 20 - 10 * args.verbose)))
|
||||
log = logging.getLogger("sws_npz")
|
||||
|
||||
log.info("Starting sws -> npz converter")
|
||||
config = configparser.ConfigParser()
|
||||
config.read("config.ini")
|
||||
|
||||
sws_out = pathlib.Path(config.get("swash", "out"))
|
||||
inp = pathlib.Path(config.get("post", "inp"))
|
||||
|
||||
log.info(f"Reading swash output from '{sws_out}'")
|
||||
rsws = ReadSwash()
|
||||
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,
|
||||
"botl": rsws.read_const,
|
||||
"watl": rsws.read_scalar,
|
||||
"vel": rsws.read_vector,
|
||||
"press": rsws.read_scalar,
|
||||
"zk": rsws.read_scalar_lay,
|
||||
"velk": rsws.read_vector_lay,
|
||||
"vz": rsws.read_scalar_lay,
|
||||
}
|
||||
|
||||
inp.mkdir(exist_ok=True)
|
||||
with ThreadPool() as pool:
|
||||
log.info("Converting all data")
|
||||
pool.map(
|
||||
lambda x: np.save(
|
||||
inp.joinpath(x[0]),
|
||||
x[1](sws_out.joinpath(x[0]).with_suffix(".dat")),
|
||||
),
|
||||
var.items(),
|
||||
)
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:f3b186f594089b65b3739d2f03855c691f45e0b2744e37196e07cdf60c896cfc
|
||||
size 1393
|
||||
|
|
|
|||
Reference in a new issue