1
Fork 0

Update wavelet script

This commit is contained in:
Edgar P. Burkhart 2023-05-16 11:54:53 +02:00
parent 65c97cf8d1
commit 4ae8a0def6
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227

View file

@ -36,11 +36,11 @@ log.info("Plotting results")
vlim = np.nanmin(np.maximum(watl, -botl)), np.nanmax(np.maximum(watl, -botl)) vlim = np.nanmin(np.maximum(watl, -botl)), np.nanmax(np.maximum(watl, -botl))
x0 = np.linspace(-600, -200, 5) x0 = np.linspace(-700, -200, 6)
i0 = np.argmin(np.abs(x[:, None] - x0), axis=0) i0 = np.argmin(np.abs(x[:, None] - x0), axis=0)
fig_x, ax = plt.subplots( fig_x, ax = plt.subplots(
5, 1, figsize=(15 / 2.54, 15/ 2.54), constrained_layout=True 3, 2, figsize=(15 / 2.54, 7.5 / 2.54), constrained_layout=True
) )
dt = np.mean(np.diff(t)) dt = np.mean(np.diff(t))
N = t.size N = t.size
@ -55,8 +55,8 @@ M = np.stack([(np.abs(sgl.cwt(watl[:, i], sgl.morlet2, Mw))/sig)**2 for i in i0]
v = np.max(M) v = np.max(M)
T = 2 * sj * np.pi / 5 T = 2 * sj * np.pi / 5
for ax_x, M_, x_ in zip(ax.reshape(-1), M, x[i0]): for ax_x, M_, x_ in zip(ax.flatten(), M, x[i0]):
c = ax_x.contourf(t, T, M_, cmap="Greys", vmin=0, levels=[1, 2.5, 5, 10, 20, 40], extend="both") c = ax_x.contourf(t, T, M_, cmap="Greys", vmin=0, levels=[1, 4, 16, 64], extend="both")
fig_x.colorbar(c, ax=ax_x, label="NWPS") fig_x.colorbar(c, ax=ax_x, label="NWPS")
ax_x.grid(color="k", alpha=0.2) ax_x.grid(color="k", alpha=0.2)
ax_x.text( ax_x.text(
@ -77,7 +77,7 @@ for ax_x, M_, x_ in zip(ax.reshape(-1), M, x[i0]):
ax_x.yaxis.set_major_locator(LogLocator(10, numticks=2**10)) ax_x.yaxis.set_major_locator(LogLocator(10, numticks=2**10))
ax_x.yaxis.set_minor_locator(LogLocator(10, subs=np.arange(10), numticks=2**10)) ax_x.yaxis.set_minor_locator(LogLocator(10, subs=np.arange(10), numticks=2**10))
ax_x.yaxis.set_minor_formatter(NullFormatter()) ax_x.yaxis.set_minor_formatter(NullFormatter())
if ax_x != ax.reshape(-1)[-1]: if ax_x not in ax[-1]:
ax_x.axes.set_xticklabels([]) ax_x.axes.set_xticklabels([])
else: else:
ax_x.set(xlabel="t (s)") ax_x.set(xlabel="t (s)")