1
Fork 0

Updates in data

This commit is contained in:
Edgar P. Burkhart 2022-03-11 14:11:48 +01:00
parent 1323a6b5fe
commit 8ff521ee0b
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
3 changed files with 14 additions and 31 deletions

1
data/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/out

View file

@ -1,7 +1,8 @@
[bathy] [bathy]
inp=Database_20220224.xyz inp=data/Database_20220224.xyz
sub=bathy_sub.npy sub=out/bathy_sub.npy
out=bathy.npy out=out/bathy.npy
step=1
[artha] [artha]
lat=43.398450 lat=43.398450

View file

@ -32,7 +32,7 @@ bathy = np.stack(
*projection.cartesian(bathy_curvi[:, 0], bathy_curvi[:, 1]), *projection.cartesian(bathy_curvi[:, 0], bathy_curvi[:, 1]),
bathy_curvi[:, 2], bathy_curvi[:, 2],
), ),
axis=1 axis=1,
) )
log.debug(f"Cartesian bathy: {bathy}") log.debug(f"Cartesian bathy: {bathy}")
@ -46,37 +46,18 @@ buoy_curvi = np.array(
artha = np.asarray(projection.cartesian(*artha_curvi)) artha = np.asarray(projection.cartesian(*artha_curvi))
buoy = np.asarray(projection.cartesian(*buoy_curvi)) buoy = np.asarray(projection.cartesian(*buoy_curvi))
def display():
x = np.linspace(bathy[:, 0].min(), bathy[:, 0].max())
y = np.linspace(bathy[:, 1].min(), bathy[:, 1].max())
X, Y = np.meshgrid(x, y)
Z = interpolate.griddata(
bathy[:, :2], bathy[:, 2], (X, Y), method="nearest"
)
fix, ax = plt.subplots()
ax.pcolormesh(X, Y, Z)
ax.scatter(*artha, c="k")
ax.scatter(*buoy, c="k")
ax.axis("equal")
return ax
D = np.diff(np.stack((artha, buoy)), axis=0) D = np.diff(np.stack((artha, buoy)), axis=0)
x = np.arange(-150, np.sqrt((D**2).sum()) + 150) x = np.arange(
-150,
np.sqrt((D**2).sum()) + 150,
config.getfloat("bathy", "step", fallback=1),
)
theta = np.angle(D.dot((1, 1j))) theta = np.angle(D.dot((1, 1j)))
coords = artha + (x * np.stack((np.cos(theta), np.sin(theta)))).T coords = artha + (x * np.stack((np.cos(theta), np.sin(theta)))).T
log.info("Interpolating bathymetry in 1D")
z = interpolate.griddata(bathy[:, :2], bathy[:, 2], coords) z = interpolate.griddata(bathy[:, :2], bathy[:, 2], coords)
log.debug(z)
ax = display()
ax.scatter(*coords.T, c="k", marker=".")
fig_1d, ax_1d = plt.subplots()
ax_1d.plot(x, z)
plt.show(block=True)