From 4ae8a0def6bbe885c97cf720cf0736728ae89166 Mon Sep 17 00:00:00 2001 From: "Edgar P. Burkhart" Date: Tue, 16 May 2023 11:54:53 +0200 Subject: [PATCH] Update wavelet script --- swash/processing/wavelet.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/swash/processing/wavelet.py b/swash/processing/wavelet.py index 5ac907a..2cb55ab 100644 --- a/swash/processing/wavelet.py +++ b/swash/processing/wavelet.py @@ -36,11 +36,11 @@ log.info("Plotting results") 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) 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)) 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) T = 2 * sj * np.pi / 5 -for ax_x, M_, x_ in zip(ax.reshape(-1), M, x[i0]): - c = ax_x.contourf(t, T, M_, cmap="Greys", vmin=0, levels=[1, 2.5, 5, 10, 20, 40], extend="both") +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, 4, 16, 64], extend="both") fig_x.colorbar(c, ax=ax_x, label="NWPS") ax_x.grid(color="k", alpha=0.2) 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_minor_locator(LogLocator(10, subs=np.arange(10), numticks=2**10)) 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([]) else: ax_x.set(xlabel="t (s)")