Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download

Figure notebooks for 'Lagrangian filtering for wave–mean flow decomposition'.

135 views
unlisted
ubuntu2204
Kernel: Python 3 (system-wide)

logo

import matplotlib.pyplot as plt import xarray as xr import numpy as np plt.rcParams.update({'font.size': 18}) plt.rc('text', usetex=True) plt.rc('text.latex',preamble=r"\usepackage{amsmath}") plt.rc('font', family='serif')
# Loading datasets ds_lp = xr.open_dataset('../Data/solver_lowpass_x_y_omega_2_Nint_1_strat_3_T_40.nc')
# Initialising figure fig, axes = plt.subplots(4,3,figsize = (15,18),constrained_layout=True) # Plotting vmin = -1 vmax = 1 p0=axes[0,0].pcolormesh(ds_lp.z_inst,vmin = vmin, vmax = vmax,cmap = 'RdBu_r') axes[0,1].pcolormesh(ds_lp.z_EM,vmin = vmin, vmax = vmax,cmap = 'RdBu_r') axes[0,2].pcolormesh(ds_lp.z_inst - ds_lp.z_EM,vmin = vmin, vmax = vmax,cmap = 'RdBu_r') axes[1,0].pcolormesh(ds_lp.z_inst,vmin = vmin, vmax = vmax,cmap = 'RdBu_r') axes[1,1].pcolormesh(ds_lp.z_LM_at_mean,vmin = vmin, vmax = vmax,cmap = 'RdBu_r') axes[1,2].pcolormesh(ds_lp.z_inst - ds_lp.z_LM_at_mean,vmin = vmin, vmax = vmax,cmap = 'RdBu_r') axes[2,0].pcolormesh(ds_lp.z_inst,vmin = vmin, vmax = vmax,cmap = 'RdBu_r') axes[2,1].pcolormesh(ds_lp.z_LM_at_mid,vmin = vmin, vmax = vmax,cmap = 'RdBu_r') axes[2,2].pcolormesh(ds_lp.z_inst-ds_lp.z_LM_at_mid,vmin = vmin, vmax = vmax,cmap = 'RdBu_r') axes[3,0].pcolormesh(ds_lp.z_inst_at_mean,vmin = vmin, vmax = vmax,cmap = 'RdBu_r') axes[3,1].pcolormesh(ds_lp.z_LM_at_mean,vmin = vmin, vmax = vmax,cmap = 'RdBu_r') axes[3,2].pcolormesh(ds_lp.z_inst_at_mean-ds_lp.z_LM_at_mean,vmin = vmin, vmax = vmax,cmap = 'RdBu_r') fig.colorbar(p0,ax=axes[0,2],label='Relative vorticity') fig.colorbar(p0,ax=axes[1,2],label='Relative vorticity') fig.colorbar(p0,ax=axes[2,2],label='Relative vorticity') fig.colorbar(p0,ax=axes[3,2],label='Relative vorticity') textposx = 8 textposy = 234 bbox=dict(facecolor='white', edgecolor='none', boxstyle='round') axes[0,0].text(textposx,textposy,r'a) $\zeta(\mathbf{x})$',bbox=bbox) axes[0,1].text(textposx,textposy,r'b) $\overline{\zeta}^\mathrm{E}(\mathbf{x})$',bbox=bbox) axes[0,2].text(textposx,textposy,r'c) $\zeta_\mathrm{E}^\mathrm{w} = \zeta(\mathbf{x}) - \overline{\zeta}^\mathrm{E}(\mathbf{x})$',bbox=bbox) axes[1,0].text(textposx,textposy,r'd) $\zeta(\mathbf{x})$',bbox=bbox) axes[1,1].text(textposx,textposy,r'e) $\overline{\zeta}^\mathrm{L}(\mathbf{x})$',bbox=bbox) axes[1,2].text(textposx,textposy,r'f) $\zeta_\mathrm{S-E}^\mathrm{w} = \zeta(\mathbf{x}) - \overline{\zeta}^\mathrm{L}(\mathbf{x})$',bbox=bbox) axes[2,0].text(textposx,textposy,r'g) $\zeta(\mathbf{x})$',bbox=bbox) axes[2,1].text(textposx,textposy,r'h) $\zeta^*(\mathbf{x}) = \overline{\zeta}^\mathrm{L}(\boldsymbol{\Xi^{3 \mapsto 2}}(\mathbf{x}))$',bbox=bbox) axes[2,2].text(textposx,textposy,r'i) $\zeta_\mathrm{L1}^\mathrm{w} = \zeta(\mathbf{x}) - \zeta^*(\mathbf{x})$',bbox=bbox) axes[3,0].text(textposx,textposy,r'j) $\zeta((\boldsymbol{\Xi^{3 \mapsto 2}})^{-1}(\mathbf{x}))$',bbox=bbox) axes[3,1].text(textposx,textposy,r'k) $\overline{\zeta}^\mathrm{L}(\mathbf{x})$',bbox=bbox) axes[3,2].text(textposx,textposy,r'l) $\zeta_\mathrm{L2}^\mathrm{w} = \zeta((\boldsymbol{\Xi^{3 \mapsto 2}})^{-1}(\mathbf{x})) - \overline{\zeta}^\mathrm{L}(\mathbf{x})$',bbox=bbox) # Formatting [axes[i,j].set_aspect('equal') for i in range(4) for j in range(3)]; axes[0,0].set_ylabel('Eulerian wave decomposition (E)') axes[1,0].set_ylabel('Semi-Eulerian wave decomposition (S-E)') axes[2,0].set_ylabel(r'Lagrangian wave decomposition (L1)') axes[3,0].set_ylabel(r'Lagrangian wave decomposition (L2)') [axes[i,j].axes.set_xticklabels([]) for i in range(4) for j in range(3)]; [axes[i,j].axes.set_yticklabels([]) for i in range(4) for j in range(3)]; fig.savefig('Figure-5.png',dpi=200,bbox_inches='tight')
Image in a Jupyter notebook

The four different wave decompositions: (top) Eulerian, (second row) semi-Eulerian, (third row) Lagrangian first definition, and (bottom) Lagrangian second definition. For each row, the middle 'mean' field is subtracted from the left 'instantaneous' field to give the right 'wave' field. The flow parameters are as for figure 2, and strategy 3 is used.

More data variables are available in the xarray dataset:

ds_lp