diff --git a/data/config.ini b/data/config.ini index 2bc804a..33b5bf0 100644 --- a/data/config.ini +++ b/data/config.ini @@ -8,6 +8,7 @@ psize=Psize.dat hires_step=0.5 [out] +no_breakwater=True root=out sub=bathy_sub.npy out=bathy.npy diff --git a/data/processing/projection.py b/data/processing/projection.py index ae4284e..8b104ff 100644 --- a/data/processing/projection.py +++ b/data/processing/projection.py @@ -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=" ")