1
Fork 0

Change config

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

View file

@ -1,9 +1,13 @@
[bathy] [inp]
inp=data/Database_20220224.xyz root=data
hires=data/bathyhires.dat base=Database_20220224.xyz
hires=bathyhires.dat
hires_step=0.5 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 step=1
[artha] [artha]

View file

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

View file

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