1
Fork 0
internship/swash/processing/post.py

37 lines
958 B
Python
Raw Normal View History

2022-03-02 14:25:53 +01:00
import configparser
import pathlib
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from .read_swash import *
config = configparser.ConfigParser()
config.read("config.ini")
cache = pathlib.Path(config.get("out", "root"))
root = pathlib.Path(config.get("swash", "out"))
bathy = pd.read_hdf(cache.joinpath("bathy.h5"), "bathy")
n = bathy.index.size
2022-03-02 15:52:46 +01:00
# xp = read_nohead_scalar(root.joinpath("xp.dat"), n)
2022-03-02 14:25:53 +01:00
botl = read_nohead_scalar(root.joinpath("botl.dat"), n)
2022-03-02 15:52:46 +01:00
dep = np.maximum(0, read_nohead_scalar(root.joinpath("dep.dat"), n))
vel = read_nohead_vect(root.joinpath("vel.dat"), n)
2022-03-02 15:52:46 +01:00
# watl = read_nohead_scalar(root.joinpath("watl.dat"), n)
fig, (ax_dep, ax_vel) = plt.subplots(2)
ax_dep.plot((dep - botl)[:, n//2], label="dep", color="#0066ff")
ax_dep.set(xlabel="t (s)", ylabel="z (m)")
ax_vel.plot(vel[:, 0, n//2], label="vel")
ax_vel.set(xlabel="t (s)", ylabel="U (m/s)")
fig.tight_layout()
#fig.legend()
2022-03-02 14:25:53 +01:00
plt.show(block=True)