diff --git a/data/config.ini b/data/config.ini index d8da6b7..4a6214a 100644 --- a/data/config.ini +++ b/data/config.ini @@ -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] diff --git a/data/processing/projection.py b/data/processing/projection.py index ae62196..c0de89e 100644 --- a/data/processing/projection.py +++ b/data/processing/projection.py @@ -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]), ) + + diff --git a/data/processing/subdomain.py b/data/processing/subdomain.py index 88c3d96..73f62bd 100644 --- a/data/processing/subdomain.py +++ b/data/processing/subdomain.py @@ -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}")