1
Fork 0

Change config

This commit is contained in:
Edgar P. Burkhart 2022-03-11 14:55:16 +01:00
parent cb5966c9ce
commit 187e8f0ce7
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
3 changed files with 22 additions and 12 deletions

View file

@ -1,9 +1,13 @@
[bathy]
inp=data/Database_20220224.xyz
hires=data/bathyhires.dat
[inp]
root=data
base=Database_20220224.xyz
hires=bathyhires.dat
hires_step=0.5
sub=out/bathy_sub.npy
out=out/bathy.npy
[out]
root=out
sub=bathy_sub.npy
out=bathy.npy
step=1
[artha]

View file

@ -20,9 +20,11 @@ log.info("Starting bathymetry pre-processing")
config = configparser.ConfigParser()
config.read("config.ini")
bathy_inp = pathlib.Path(config.get("bathy", "sub"))
hires_inp = pathlib.Path(config.get("bathy", "hires"))
bathy_out = pathlib.Path(config.get("bathy", "out"))
inp_root = pathlib.Path(config.get("inp", "root"))
out_root = pathlib.Path(config.get("out", "root"))
bathy_inp = out_root.joinpath(config.get("out", "sub"))
hires_inp = inp_root.joinpath(config.get("inp", "hires"))
bathy_out = inp_root.joinpath(config.get("out", "out"))
log.info(f"Loading bathymetry from {bathy_inp}")
bathy_curvi = np.load(bathy_inp)
@ -51,7 +53,7 @@ D = np.diff(np.stack((artha, buoy)), axis=0)
x = np.arange(
-150,
np.sqrt((D**2).sum()) + 150,
config.getfloat("bathy", "step", fallback=1),
config.getfloat("out", "step", fallback=1),
)
theta = np.angle(D.dot((1, 1j)))
@ -66,7 +68,7 @@ bathy_hires = np.stack(
(
np.linspace(
0,
(_hires.size - 1) * config.getfloat("bathy", "hires_step"),
(_hires.size - 1) * config.getfloat("inp", "hires_step"),
_hires.size,
),
_hires,
@ -96,3 +98,5 @@ z[flt_x] = interpolate.griddata(
bathy_hires[:, 1],
(x[flt_x] - x[z_crossing] + bathy_hires[hires_crossing, 0]),
)

View file

@ -33,8 +33,10 @@ domain[0] -= 0.002
domain[1] += 0.002
log.debug(f"domain: {domain}")
bathy_inp = pathlib.Path(config.get("bathy", "inp"))
bathy_out = pathlib.Path(config.get("bathy", "sub"))
inp_root = pathlib.Path(config.get("inp", "root"))
out_root = pathlib.Path(config.get("out", "root"))
bathy_inp = inp_root.joinpath(config.get("inp", "base"))
bathy_out = out_root.joinpath(config.get("out", "sub"))
log.info(f"Reading bathymetry from '{bathy_inp}'")
raw_bathy = np.genfromtxt(bathy_inp)
log.debug(f"Initial size: {raw_bathy.shape}")