Looking at the M2 baroclinic kinetic energy which I define as 0.5*(major^2 +minor^2)
import matplotlib.pylab as plt
import numpy as np
import scipy.io as sio
import netCDF4 as nc
from salishsea_tools.nowcast import (research_VENUS)
from salishsea_tools import viz_tools
import baroclinic as bc
import os
%matplotlib inline
path = '/ocean/nsoontie/MEOPAR/TidalEllipseData/CODAR/CODAR_region_baroclinic_20141126_20150426_masked.mat'
data = sio.loadmat(path)
datastruc = data['datastruc']
major, minor, phase , inc= bc.get_constituent('M2', datastruc)
lons = datastruc['lons'][0,0]
lats = datastruc['lats'][0,0]
ke = 0.5*(major**2 +minor**2)
depths = datastruc['depth'][0,0]
Surface
j=30
i=55
jvec = np.arange(75,0,-1)
ivec = np.arange(0,75,1)
jvec2 = np.arange(0,50,1)
ivec2 = np.arange(30,80,1)
d=0
fig, ax = plt.subplots(1,1,figsize=(5,5))
mesh = ax.pcolormesh(ke[:,:,d].T,vmin=0, vmax=0.1, cmap='hot')
cbar = plt.colorbar(mesh, ax=ax)
cbar.set_label('M2 baroclinic KE [m^2/s^2]')
ax.set_title('M2 surface')
ax.plot([0,90],[j,j],'r')
ax.plot([i,i],[0,90],'r')
ax.plot(ivec,jvec,'r')
ax.plot(ivec2,jvec2,'r')
[<matplotlib.lines.Line2D at 0x7f62ff911278>]
Horizontal line slice
fig, ax = plt.subplots(1,1,figsize=(5,5))
mesh = ax.pcolormesh( np.arange(ke.shape[0]), depths, ke[:,j,:].T,vmin=0, vmax=0.02, cmap='hot')
cbar = plt.colorbar(mesh, ax=ax)
cbar.set_label('M2 baroclinic KE [m^2/s^2]')
ax.set_title('M2 surface')
ax.set_ylim([300,0])
(300, 0)
Vertical slice
fig, ax = plt.subplots(1,1,figsize=(5,5))
mesh = ax.pcolormesh( np.arange(ke.shape[1]), depths, ke[i,:,:].T,vmin=0, vmax=0.02, cmap='hot')
cbar = plt.colorbar(mesh, ax=ax)
cbar.set_label('M2 baroclinic KE [m^2/s^2]')
ax.set_title('M2 surface')
ax.set_ylim([300,0])
(300, 0)
Diagonal slice (negative slope)
fig, ax = plt.subplots(1,1,figsize=(5,5))
mesh = ax.pcolormesh( jvec, depths, ke[ivec,jvec,:].T,vmin=0, vmax=0.02, cmap='hot')
cbar = plt.colorbar(mesh, ax=ax)
cbar.set_label('M2 baroclinic KE [m^2/s^2]')
ax.set_title('M2 surface')
ax.set_ylim([300,0])
(300, 0)
Diagnoal slice (positve slope)
fig, ax = plt.subplots(1,1,figsize=(5,5))
mesh = ax.pcolormesh( ivec2, depths, ke[ivec2,jvec2,:].T,vmin=0, vmax=0.02, cmap='hot')
cbar = plt.colorbar(mesh, ax=ax)
cbar.set_label('M2 baroclinic KE [m^2/s^2]')
ax.set_title('M2 surface')
ax.set_ylim([300,0])
(300, 0)