1
Fork 0

Swash processing for article

This commit is contained in:
Edgar P. Burkhart 2022-07-06 07:55:33 +02:00
parent 34fcb4e879
commit 14ef85246a
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
2 changed files with 9 additions and 3 deletions

View file

@ -4,6 +4,7 @@ import logging
import pathlib
import matplotlib.pyplot as plt
from matplotlib.ticker import MultipleLocator, LogLocator, NullFormatter
import numpy as np
import scipy.signal as sgl
@ -49,12 +50,13 @@ J = 1 / dj * np.log2(N * dt / s0)
j = np.arange(0, J)
sj = s0 * 2 ** (j * dj)
Mw = sj / dt
sig = np.var(watl[:, i0])
sig = np.std(watl[:, i0])
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, sj, 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, 2.5, 5, 10, 20, 40], extend="both")
fig_x.colorbar(c, ax=ax_x, label="NWPS")
ax_x.grid(color="k", alpha=0.2)
ax_x.text(
@ -71,6 +73,10 @@ for ax_x, M_, x_ in zip(ax.reshape(-1), M, x[i0]):
ax_x.set_rasterization_zorder(1.5)
ax_x.set(ylabel="T (s)", ylim=(sj[0], sj[-1]))
ax_x.xaxis.set_minor_locator(MultipleLocator(100))
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]:
ax_x.axes.set_xticklabels([])
else:

View file

@ -76,7 +76,7 @@ ax.grid()
fig.savefig(out.joinpath("wsize.pdf"))
fig2, ax2 = plt.subplots(
figsize=(10 / 2.54, 2 / 3 * 10 / 2.54), constrained_layout=True
figsize=(10 / 2.54, 4 / 2.54), constrained_layout=True
)
ax2.plot(
t[cr0[i0 - 5] : cr0[i0 + 7]] * 1e-3,