From 133edefec2d71cf2c8da7b82c0315e518466d93a Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Thu, 3 Mar 2022 15:19:30 +0100 Subject: [PATCH] Added t0 to post --- swash/processing/post.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/swash/processing/post.py b/swash/processing/post.py index 5b5dd7a..5e015b5 100644 --- a/swash/processing/post.py +++ b/swash/processing/post.py @@ -36,15 +36,16 @@ vel = read_nohead_vect(root.joinpath("vel.dat"), n) dt = config.getfloat("post", "dt") n_t = botl.shape[0] -t = np.arange(0, n_t*dt, dt) +t = np.arange(0, n_t * dt, dt) # Cospectral calculations pos_x = config.getint("post", "x0") +t0 = config.getint("post", "t0") f = 1 / dt log.info(f"Computing reflection coefficient at x={pos_x}") -eta = (dep - botl)[n_t // 2 :, pos_x] -u = vel[n_t // 2 :, 0, pos_x] +eta = (dep - botl)[t > t0, pos_x] +u = vel[t > t0, 0, pos_x] phi_eta = np.abs(sgl.csd(eta, eta, f)) phi_u = np.abs(sgl.csd(u, u, f)) @@ -59,15 +60,17 @@ R = np.sqrt( log.info("Plotting results") fig, (ax_dep, ax_vel) = plt.subplots(2) -ax_dep.plot(t, (dep - botl)[:, pos_x], label="dep", color="#0066ff") +ax_dep.plot(t, (dep - botl)[:, pos_x], label="dep") ax_dep.set(xlabel="t (s)", ylabel="z (m)") ax_dep.autoscale(axis="x", tight=True) ax_dep.grid() +ax_dep.axvline(t0) ax_vel.plot(t, vel[:, 0, pos_x], label="vel") ax_vel.set(xlabel="t (s)", ylabel="U (m/s)") ax_vel.autoscale(axis="x", tight=True) ax_vel.grid() +ax_vel.axvline(t0) fig.tight_layout()