1
Fork 0

Added output of bathy and hstru to preprocess

This commit is contained in:
Edgar P. Burkhart 2022-03-02 11:47:57 +01:00
parent 2b6c561104
commit f329690c3d
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
3 changed files with 19 additions and 5 deletions

1
swash/.gitignore vendored
View file

@ -1 +1,2 @@
/cache
/swash_buoytoartha /swash_buoytoartha

View file

@ -8,3 +8,6 @@ bathy=buoyarthabathy.dat
hstru=Hstru.dat hstru=Hstru.dat
poro=Poro.dat poro=Poro.dat
psize=Psize.dat psize=Psize.dat
[out]
root=cache

View file

@ -31,10 +31,20 @@ x_hstru = np.arange(-0.5 * hstru.size, 0, 0.5)
bathy_hires_pd = pd.Series(bathy_hires.copy(), index=x_hires) bathy_hires_pd = pd.Series(bathy_hires.copy(), index=x_hires)
bathy_lores_pd = pd.Series(bathy_lores.copy(), index=x_lores) bathy_lores_pd = pd.Series(bathy_lores.copy(), index=x_lores)
bathy = bathy_lores_pd.reindex( bathy = pd.DataFrame(
bathy_lores_pd.index.union(bathy_hires_pd.index) index=bathy_lores_pd.index.union(bathy_hires_pd.index),
columns=("z", "hstru"),
) )
bathy[bathy_hires_pd.index] = bathy_hires_pd bathy.z[bathy_lores_pd.index] = bathy_lores_pd
bathy.z[bathy_hires_pd.index] = bathy_hires_pd
bathy.hstru = 0
bathy.loc[x_hstru, "hstru"] = hstru
if config.has_section("out"):
out = pathlib.Path(config.get("out", "root"))
np.savetxt(out.joinpath("bathy.dat"), bathy.z, newline=" ")
np.savetxt(out.joinpath("hstru.dat"), bathy.hstru, newline=" ")
if config.getboolean("proc", "plot", fallback=False): if config.getboolean("proc", "plot", fallback=False):
if plt is None: if plt is None:
@ -44,8 +54,8 @@ if config.getboolean("proc", "plot", fallback=False):
fig, ax = plt.subplots() fig, ax = plt.subplots()
ax.plot(x_hires, bathy_hires, label="High-res") ax.plot(x_hires, bathy_hires, label="High-res")
ax.plot(x_lores, bathy_lores, label="Low-res") ax.plot(x_lores, bathy_lores, label="Low-res")
ax.plot(x_hstru, bathy[x_hstru]+hstru, label="H stru") ax.plot(bathy.index, bathy.z, ls="-.", c="k", label="Combined")
ax.plot(bathy.index, bathy, ls="-.", c="k", label="Combined") ax.plot(bathy.index, bathy.hstru, label="H stru")
ax.grid() ax.grid()
ax.legend() ax.legend()