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_s1 = xr.open_dataset('../Data/solver_lowpass_x_y_omega_2_Nint_1_strat_1_T_40.nc') ds_s3 = xr.open_dataset('../Data/solver_lowpass_x_y_omega_2_Nint_1_strat_3_T_40.nc')
# Initialising figure fig, axes = plt.subplots(2,3,figsize = (15,10),constrained_layout=True) # Plotting vmin = -1 vmax = 1 p0=axes[0,0].pcolormesh(ds_s1.z_LM_at_end,vmin = vmin, vmax = vmax,cmap = 'RdBu_r') axes[1,0].pcolormesh(ds_s3.z_LM_at_mid,vmin = vmin, vmax = vmax,cmap = 'RdBu_r') axes[0,1].pcolormesh(ds_s1.z_LM_at_mean,vmin = vmin, vmax = vmax,cmap = 'RdBu_r') p1 = axes[0,2].pcolormesh(ds_s1.Xi12_y,vmin = 0, vmax = 2*np.pi,cmap = 'viridis') axes[0,2].contour(ds_s1.Xi12_y,levels=50,linewidths=0.5,colors='k') axes[1,1].pcolormesh(ds_s3.z_LM_at_mean,vmin = vmin, vmax = vmax,cmap = 'RdBu_r') axes[1,2].pcolormesh(ds_s3.Xi32_y,vmin = 0, vmax = 2*np.pi,cmap = 'viridis') axes[1,2].contour(ds_s3.Xi32_y,levels=50,linewidths=0.5,colors='k') textposx = 6 textposy = 236 bbox=dict(facecolor='white', edgecolor='none', boxstyle='round') axes[0,0].text(textposx,textposy,r'a) Strategy 1, $\tilde{\zeta}(\mathbf{x})$ ',bbox=bbox) axes[0,1].text(textposx,textposy,r'b) Strategy 1, $\overline{\zeta}^\mathrm{L}\,(= \tilde{\zeta}((\boldsymbol{\Xi^{1 \mapsto 2}})^{-1}(\mathbf{x}))$ ',bbox=bbox) axes[0,2].text(textposx,textposy,r'c) Strategy 1, $\boldsymbol{\Xi^{1 \mapsto 2}}\cdot \hat{\mathbf{y}}$',bbox=bbox) axes[1,0].text(textposx,textposy,r'd) Strategy 3, $\zeta^*(\mathbf{x})$',bbox=bbox) axes[1,1].text(textposx,textposy,r'e) Strategy 3, $\overline{\zeta}^\mathrm{L}\,(= \zeta^*((\boldsymbol{\Xi^{3 \mapsto 2}})^{-1}(\mathbf{x})))$',bbox=bbox) axes[1,2].text(textposx,textposy,r'f) Strategy 3, $\boldsymbol{\Xi^{3 \mapsto 2}}\cdot \hat{\mathbf{y}}$',bbox=bbox) cbar_ax1 = fig.add_axes([0.035, -0.052, 0.6, 0.05]) cbar_ax2 = fig.add_axes([0.7, -0.052, 0.275, 0.05]) fig.colorbar(p0, cax=cbar_ax1, orientation = 'horizontal',label='Relative vorticity') fig.colorbar(p1, cax=cbar_ax2, orientation = 'horizontal',label=r'Final $y$-map') # Formatting [axes[i,j].axes.set_xticklabels([]) for i in range(2) for j in range(3)]; [axes[i,j].axes.set_yticklabels([]) for i in range(2) for j in range(3)]; [axes[i,j].set_aspect('equal') for i in range(2) for j in range(3)]; fig.savefig('Figure-4.png',dpi=200,bbox_inches='tight')
Image in a Jupyter notebook

Comparison of calculation of ζL\overline{\zeta}^\mathrm{L} using strategies 1 and 3 with T=20T=20. a) ζ~\tilde{\zeta}, found using strategy 1, b) ζL\overline{\zeta}^\mathrm{L}, found by remapping ζ~\tilde{\zeta} using Ξ12\bm{\Xi}^{1 \mapsto 2}, and c) the yy component of Ξ12\bm{\Xi}^{1 \mapsto 2}. d) ζ\zeta^*, found using strategy 3, e) ζL\overline{\zeta}^\mathrm{L}, found by remapping ζ\zeta^* using Ξ13\bm{\Xi}^{1 \mapsto 3}, and f) the yy component of Ξ13\bm{\Xi}^{1 \mapsto 3}. xx and yy axes correspond to xx and yy coordinates of the full domain.

More data variables are available in the xarray dataset:

ds_s3