1
Fork 0

Add no breakwater case

This commit is contained in:
Edgar P. Burkhart 2022-03-17 12:19:49 +01:00
parent 095964f7ae
commit be4a18165f
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
2 changed files with 30 additions and 26 deletions

View file

@ -8,6 +8,7 @@ psize=Psize.dat
hires_step=0.5
[out]
no_breakwater=True
root=out
sub=bathy_sub.npy
out=bathy.npy

View file

@ -99,35 +99,38 @@ x_max_hires = x[z_crossing] + (
log.debug(f"Replacing range: [{x_min_hires},{x_max_hires}]")
flt_x = (x > x_min_hires) & (x < x_max_hires)
z[flt_x] = interpolate.griddata(
(bathy_hires[:, 0],),
bathy_hires[:, 1],
(x[flt_x] - x[z_crossing] + bathy_hires[hires_crossing, 0]),
)
hstru_in = np.loadtxt(hstru_inp)[::-1]
hstru = np.zeros(z.shape)
hstru[flt_x] = interpolate.griddata(
(bathy_hires[:,0],),
hstru_in,
(x[flt_x] - x[z_crossing] + bathy_hires[hires_crossing, 0]),
)
poro_in = np.loadtxt(poro_inp)[::-1]
poro = np.zeros(z.shape)
poro[flt_x] = interpolate.griddata(
(bathy_hires[:,0],),
poro_in,
(x[flt_x] - x[z_crossing] + bathy_hires[hires_crossing, 0]),
)
psize_in = np.loadtxt(psize_inp)[::-1]
psize = np.zeros(z.shape)
psize[flt_x] = interpolate.griddata(
(bathy_hires[:,0],),
psize_in,
(x[flt_x] - x[z_crossing] + bathy_hires[hires_crossing, 0]),
)
if config.getboolean("out", "no_breakwater", fallback=False):
z[flt_x] = z[flt_x][-1]
else:
z[flt_x] = interpolate.griddata(
(bathy_hires[:, 0],),
bathy_hires[:, 1],
(x[flt_x] - x[z_crossing] + bathy_hires[hires_crossing, 0]),
)
hstru_in = np.loadtxt(hstru_inp)[::-1]
hstru[flt_x] = interpolate.griddata(
(bathy_hires[:,0],),
hstru_in,
(x[flt_x] - x[z_crossing] + bathy_hires[hires_crossing, 0]),
)
poro_in = np.loadtxt(poro_inp)[::-1]
poro[flt_x] = interpolate.griddata(
(bathy_hires[:,0],),
poro_in,
(x[flt_x] - x[z_crossing] + bathy_hires[hires_crossing, 0]),
)
psize_in = np.loadtxt(psize_inp)[::-1]
psize[flt_x] = interpolate.griddata(
(bathy_hires[:,0],),
psize_in,
(x[flt_x] - x[z_crossing] + bathy_hires[hires_crossing, 0]),
)
np.savetxt(out_root.joinpath("bathy.dat"), z[::-1], newline=" ")
np.savetxt(out_root.joinpath("hstru.dat"), hstru[::-1], newline=" ")