isort + black reformat
This commit is contained in:
parent
cf54c91fa8
commit
81f7a1299b
7 changed files with 32 additions and 41 deletions
|
@ -5,6 +5,7 @@ import pathlib
|
|||
|
||||
import numpy as np
|
||||
from scipy import interpolate
|
||||
|
||||
try:
|
||||
import matplotlib.pyplot as plt
|
||||
except ImportError:
|
||||
|
@ -49,9 +50,7 @@ log.debug(f"Cartesian bathy: {bathy}")
|
|||
artha_curvi = np.array(
|
||||
(config.getfloat("artha", "lon"), config.getfloat("artha", "lat"))
|
||||
)
|
||||
buoy_curvi = np.array(
|
||||
(config.getfloat("buoy", "lon"), config.getfloat("buoy", "lat"))
|
||||
)
|
||||
buoy_curvi = np.array((config.getfloat("buoy", "lon"), config.getfloat("buoy", "lat")))
|
||||
|
||||
artha = np.asarray(projection.cartesian(*artha_curvi))
|
||||
buoy = np.asarray(projection.cartesian(*buoy_curvi))
|
||||
|
@ -91,12 +90,8 @@ log.debug(f"Hires crossing: {hires_crossing}")
|
|||
z_crossing = np.diff(np.signbit(z - z_cr)).nonzero()[0][-1]
|
||||
log.debug(f"Z crossing: {z_crossing}")
|
||||
|
||||
x_min_hires = x[z_crossing] + (
|
||||
bathy_hires[:, 0].min() - bathy_hires[hires_crossing, 0]
|
||||
)
|
||||
x_max_hires = x[z_crossing] + (
|
||||
bathy_hires[:, 0].max() - bathy_hires[hires_crossing, 0]
|
||||
)
|
||||
x_min_hires = x[z_crossing] + (bathy_hires[:, 0].min() - bathy_hires[hires_crossing, 0])
|
||||
x_max_hires = x[z_crossing] + (bathy_hires[:, 0].max() - bathy_hires[hires_crossing, 0])
|
||||
log.debug(f"Replacing range: [{x_min_hires},{x_max_hires}]")
|
||||
|
||||
flt_x = (x > x_min_hires) & (x < x_max_hires)
|
||||
|
@ -114,21 +109,21 @@ else:
|
|||
|
||||
hstru_in = np.loadtxt(hstru_inp)[::-1]
|
||||
hstru[flt_x] = interpolate.griddata(
|
||||
(bathy_hires[:,0],),
|
||||
(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],),
|
||||
(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],),
|
||||
(bathy_hires[:, 0],),
|
||||
psize_in,
|
||||
(x[flt_x] - x[z_crossing] + bathy_hires[hires_crossing, 0]),
|
||||
)
|
||||
|
@ -141,5 +136,5 @@ np.savetxt(out_root.joinpath("psize.dat"), psize[::-1], newline=" ")
|
|||
if plt is not None and config.getboolean("out", "plot", fallback=False):
|
||||
fig, ax = plt.subplots()
|
||||
ax.plot(-x, z, color="k")
|
||||
ax.fill_between(-x, z+hstru, z, color="k", alpha=.2)
|
||||
ax.fill_between(-x, z + hstru, z, color="k", alpha=0.2)
|
||||
fig.savefig(out_root.joinpath("bathy.pdf"))
|
||||
|
|
Reference in a new issue