Added postprocessing script
This commit is contained in:
parent
dca8114bb9
commit
a9570bf333
4 changed files with 60 additions and 0 deletions
1
swash/.gitignore
vendored
1
swash/.gitignore
vendored
|
@ -1,2 +1,3 @@
|
|||
/cache
|
||||
/out
|
||||
/swash_buoytoartha
|
||||
|
|
|
@ -11,3 +11,6 @@ psize=Psize.dat
|
|||
|
||||
[out]
|
||||
root=cache
|
||||
|
||||
[swash]
|
||||
out=out
|
||||
|
|
26
swash/processing/post.py
Normal file
26
swash/processing/post.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
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
|
||||
|
||||
botl = read_nohead_scalar(root.joinpath("botl.dat"), n)
|
||||
dep = read_nohead_scalar(root.joinpath("dep.dat"), n)
|
||||
watl = read_nohead_scalar(root.joinpath("watl.dat"), n)
|
||||
|
||||
plt.plot(dep.T-botl.T, label="dep")
|
||||
plt.plot(-botl.T[:, 0], label="botl")
|
||||
plt.show(block=True)
|
30
swash/processing/read_swash.py
Normal file
30
swash/processing/read_swash.py
Normal file
|
@ -0,0 +1,30 @@
|
|||
import numpy as np
|
||||
|
||||
|
||||
def read_nohead(path):
|
||||
with open(path) as file:
|
||||
return file.read()
|
||||
|
||||
|
||||
def read_nohead_scalar(path, n):
|
||||
return np.asarray(read_nohead(path).split(), dtype=np.float64).reshape(
|
||||
(-1, n)
|
||||
)
|
||||
|
||||
|
||||
def read_nohead_k(path, n, k):
|
||||
return np.asarray(read_nohead(path).split(), dtype=np.float64).reshape(
|
||||
(-1, n, k)
|
||||
)
|
||||
|
||||
|
||||
def read_nohead_vect(path, n):
|
||||
return np.asarray(read_nohead(path).split(), dtype=np.float64).reshape(
|
||||
(-1, n, 2)
|
||||
)
|
||||
|
||||
|
||||
def read_nohead_vect_k(path, n):
|
||||
return np.asarray(read_nohead(path).split(), dtype=np.float64).reshape(
|
||||
(-1, n, 2, k)
|
||||
)
|
Loading…
Reference in a new issue