From 24d7407dfb88fd63171604068c74a4b08ee66dea Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Thu, 31 Mar 2022 10:59:30 +0200 Subject: [PATCH] Add support for multiple timeseries --- data/config.ini | 2 +- data/processing/ts.py | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/data/config.ini b/data/config.ini index 2ca1c99..955650f 100644 --- a/data/config.ini +++ b/data/config.ini @@ -5,7 +5,7 @@ hires=bathyhires.dat hstru=Hstru.dat poro=Poro.dat psize=Psize.dat -raw_ts=201702281700.raw +raw_ts=201702281700.raw,201702281730.raw hires_step=0.5 [out] diff --git a/data/processing/ts.py b/data/processing/ts.py index a8b41b0..1a9af04 100644 --- a/data/processing/ts.py +++ b/data/processing/ts.py @@ -21,22 +21,25 @@ config.read(args.config) inp_root = pathlib.Path(config.get("inp", "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") -raw_ts = np.loadtxt( - inp_ts, - dtype=[("state", int), ("z", float), ("y", float), ("x", float)], - delimiter=",", - max_rows=2304, -) +raw_ts = [] +for tsi in config.get("inp", "raw_ts").split(","): + raw_ts.append(np.loadtxt( + inp_root.joinpath(tsi), + 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=}") if (errs := np.count_nonzero(raw_ts["state"])) != 0: log.warning(f"{errs} transmission errors!") 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.info(f"Saving timeseries to '{out_ts}'")