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 hires_step=0.5
[out] [out]
no_breakwater=True
root=out root=out
sub=bathy_sub.npy sub=bathy_sub.npy
out=bathy.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}]") log.debug(f"Replacing range: [{x_min_hires},{x_max_hires}]")
flt_x = (x > x_min_hires) & (x < x_max_hires) flt_x = (x > x_min_hires) & (x < x_max_hires)
z[flt_x] = interpolate.griddata( hstru = np.zeros(z.shape)
poro = np.zeros(z.shape)
psize = np.zeros(z.shape)
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[:, 0],),
bathy_hires[:, 1], bathy_hires[:, 1],
(x[flt_x] - x[z_crossing] + bathy_hires[hires_crossing, 0]), (x[flt_x] - x[z_crossing] + bathy_hires[hires_crossing, 0]),
) )
hstru_in = np.loadtxt(hstru_inp)[::-1] hstru_in = np.loadtxt(hstru_inp)[::-1]
hstru = np.zeros(z.shape) hstru[flt_x] = interpolate.griddata(
hstru[flt_x] = interpolate.griddata(
(bathy_hires[:,0],), (bathy_hires[:,0],),
hstru_in, hstru_in,
(x[flt_x] - x[z_crossing] + bathy_hires[hires_crossing, 0]), (x[flt_x] - x[z_crossing] + bathy_hires[hires_crossing, 0]),
) )
poro_in = np.loadtxt(poro_inp)[::-1] poro_in = np.loadtxt(poro_inp)[::-1]
poro = np.zeros(z.shape) poro[flt_x] = interpolate.griddata(
poro[flt_x] = interpolate.griddata(
(bathy_hires[:,0],), (bathy_hires[:,0],),
poro_in, poro_in,
(x[flt_x] - x[z_crossing] + bathy_hires[hires_crossing, 0]), (x[flt_x] - x[z_crossing] + bathy_hires[hires_crossing, 0]),
) )
psize_in = np.loadtxt(psize_inp)[::-1] psize_in = np.loadtxt(psize_inp)[::-1]
psize = np.zeros(z.shape) psize[flt_x] = interpolate.griddata(
psize[flt_x] = interpolate.griddata(
(bathy_hires[:,0],), (bathy_hires[:,0],),
psize_in, psize_in,
(x[flt_x] - x[z_crossing] + bathy_hires[hires_crossing, 0]), (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("bathy.dat"), z[::-1], newline=" ")
np.savetxt(out_root.joinpath("hstru.dat"), hstru[::-1], newline=" ") np.savetxt(out_root.joinpath("hstru.dat"), hstru[::-1], newline=" ")