Server side scripts & all

This commit is contained in:
Edgar P. Burkhart 2022-06-24 16:50:38 +02:00
parent a000c67e93
commit b92e52ecbb
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
20 changed files with 629 additions and 58 deletions

View file

@ -7,8 +7,6 @@ import matplotlib.pyplot as plt
import numpy as np
import scipy.signal as sgl
from .read_swash import *
parser = argparse.ArgumentParser(description="Post-process swash output")
parser.add_argument("-v", "--verbose", action="count", default=0)
parser.add_argument("-c", "--config", default="config.ini")
@ -30,7 +28,8 @@ t = np.load(inp.joinpath("t.npy"))
botl = np.load(inp.joinpath("botl.npy"))
watl = np.load(inp.joinpath("watl.npy"))
vel = np.load(inp.joinpath("vel_x.npy"))
#vel = np.load(inp.joinpath("vel_x.npy"))
vel = np.load(inp.joinpath("vel.npy"))[0]
# Cospectral calculations
x0 = config.getint("post", "x0")
@ -65,22 +64,25 @@ R = np.sqrt(
if config.has_option("post", "compare"):
inp_comp = pathlib.Path(config.get("post", "compare"))
x_ = np.load(inp_comp.joinpath("xp.npy"))
t_ = np.load(inp_comp.joinpath("tsec.npy"))
x_ = np.load(inp_comp.joinpath("x.npy"))
t_ = np.load(inp_comp.joinpath("t.npy"))
botl_ = np.load(inp_comp.joinpath("botl.npy"))
watl_ = np.load(inp_comp.joinpath("watl.npy"))
vel_ = np.load(inp_comp.joinpath("vel_x.npy"))
# Cospectral calculations
arg_x0_ = np.abs(x_ - x0).argmin()
arg_t0_ = np.abs(t_ - t0).argmin()
dt_ = np.diff(t_).mean() * 1e-3
f_ = 1 / dt_
eta_ = watl_[t_ > t0, arg_x0_]
u_ = vel_[t_ > t0, arg_x0_]
phi_eta_ = sgl.welch(eta_, f, nperseg=nperseg)
phi_u_ = sgl.welch(u_, f, nperseg=nperseg)
phi_eta_u_ = sgl.csd(eta_, u_, f, nperseg=nperseg)
phi_eta_ = sgl.welch(eta_, f_, nperseg=nperseg)
phi_u_ = sgl.welch(u_, f_, nperseg=nperseg)
phi_eta_u_ = sgl.csd(eta_, u_, f_, nperseg=nperseg)
H_ = np.sqrt(np.abs(phi_eta_[1]))
U_ = np.sqrt(np.abs(phi_u_[1]))
@ -91,10 +93,6 @@ if config.has_option("post", "compare"):
(np.abs(phi_eta_[1]) + np.abs(phi_u_[1]) - 2 * phi_eta_u_[1].real)
/ (np.abs(phi_eta_[1]) + np.abs(phi_u_[1]) + 2 * phi_eta_u_[1].real)
)
# R_ = np.sqrt(
# (1 + G_**2 - 2 * G_ * np.cos(th_eta_u_))
# / (1 + G_**2 + 2 * G_ * np.cos(th_eta_u_))
# )
# Plotting