1
Fork 0

Add support for multiple timeseries

This commit is contained in:
Edgar P. Burkhart 2022-03-31 10:59:30 +02:00
parent b3af9fd66f
commit 24d7407dfb
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
2 changed files with 12 additions and 9 deletions

View file

@ -5,7 +5,7 @@ hires=bathyhires.dat
hstru=Hstru.dat hstru=Hstru.dat
poro=Poro.dat poro=Poro.dat
psize=Psize.dat psize=Psize.dat
raw_ts=201702281700.raw raw_ts=201702281700.raw,201702281730.raw
hires_step=0.5 hires_step=0.5
[out] [out]

View file

@ -21,22 +21,25 @@ config.read(args.config)
inp_root = pathlib.Path(config.get("inp", "root")) inp_root = pathlib.Path(config.get("inp", "root"))
out_root = pathlib.Path(config.get("out", "root")) out_root = pathlib.Path(config.get("out", "root"))
inp_ts = inp_root.joinpath(config.get("inp", "raw_ts"))
out_ts = out_root.joinpath("ts.dat") out_ts = out_root.joinpath("ts.dat")
raw_ts = np.loadtxt( raw_ts = []
inp_ts, for tsi in config.get("inp", "raw_ts").split(","):
dtype=[("state", int), ("z", float), ("y", float), ("x", float)], raw_ts.append(np.loadtxt(
delimiter=",", inp_root.joinpath(tsi),
max_rows=2304, dtype=[("state", int), ("z", float), ("y", float), ("x", float)],
) delimiter=",",
max_rows=2304,
))
n = len(raw_ts)
raw_ts = np.concatenate(raw_ts)
log.debug(f"{raw_ts=}") log.debug(f"{raw_ts=}")
if (errs := np.count_nonzero(raw_ts["state"])) != 0: if (errs := np.count_nonzero(raw_ts["state"])) != 0:
log.warning(f"{errs} transmission errors!") log.warning(f"{errs} transmission errors!")
log.debug(f"{dict(zip(*np.unique(raw_ts['state'], return_counts=True)))}") log.debug(f"{dict(zip(*np.unique(raw_ts['state'], return_counts=True)))}")
t = np.linspace(0, 30 * 60, 2305)[:-1] t = np.linspace(0, 30 * 60 * n, 2304*n+1)[:-1]
log.debug(f"{t=}") log.debug(f"{t=}")
log.info(f"Saving timeseries to '{out_ts}'") log.info(f"Saving timeseries to '{out_ts}'")