Another look at CODAR baroclinc tides, but focusing on the inclination and phase.

Comparing the baroclinic and barotropic ellipses.

Barotropic ellipses are found with the depth averaged currents. Depth averaging is performed over the entire water column.

Both barotropic and baroclinic were calcualted using a now cast time series Nov 26, 2014- April 26, 2015

In [1]:
import cmath
import datetime
import matplotlib.pylab as plt
import matplotlib.colors as mcolors
from matplotlib.patches import Ellipse
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

%matplotlib inline


In [2]:
#baroclinic structure
bc_struc = data['datastruc']
lats = bc_struc['lats'][0,0]
lons = bc_struc['lons'][0,0]

depths = bc_struc['depth'][0,0]

#bartropic structure
bt_struc = data['datastruc']

#full current - surface
surface_struc = data['datastruc']

grid = nc.Dataset('/data/nsoontie/MEOPAR/NEMO-forcing/grid/bathy_meter_SalishSea2.nc')
SITES = research_VENUS.SITES['VENUS']


# Full Ellipses¶

In [3]:
fig,axs = plt.subplots(1,3,figsize=(15,8))
const='M2'
sc=0.03
bc.plot_CODAR_ellipse(axs[0],lons, lats, const, bc_struc, depths, grid, baroclinic=True, depth_level=0, scale=sc)
bc.plot_CODAR_ellipse(axs[1],lons, lats, const, bt_struc, depths, grid, scale=sc, barotropic=True)
bc.plot_CODAR_ellipse(axs[2],lons, lats, const, surface_struc, depths, grid, scale=sc)
for ax in axs:
ax.set_xlim([lons[0,0]-0.23, lons[-1,-1]+0.2])
ax.set_ylim([lats[0,0]-0.05, lats[-1,-1]+0.01])
viz_tools.set_aspect(ax)

• Over the banks, the baroclinic ellipses are a lot smaller than the barotropic. Is that mostly because of the depth averaging? If the currents are primarily barotropic here, then ubc= u -udepav will be very small. But how can they be barotropic when this is where the river feeds into the domain? But it is also so shallow here.

• Is the large increase in the baroclinic major/minor axis over the slopes an artifact of this depth averaging? Is it too shallow here to do the depth avergaing without ignoring the boundary layer? Then why don't we see very large currents on the northwest side of the slopes?

In [4]:
fig,axs = plt.subplots(1,3,figsize=(15,8))
const='K1'
sc=0.05
bc.plot_CODAR_ellipse(axs[0],lons, lats, const, bc_struc, depths, grid, baroclinic=True, depth_level=0, scale=sc)
bc.plot_CODAR_ellipse(axs[1],lons, lats, const, bt_struc, depths, grid,scale=sc, barotropic=True)
bc.plot_CODAR_ellipse(axs[2],lons, lats, const, surface_struc, depths, grid, scale=sc)
for ax in axs:
ax.set_xlim([lons[0,0]-0.23, lons[-1,-1]+0.2])
ax.set_ylim([lats[0,0]-0.05, lats[-1,-1]+0.01])
viz_tools.set_aspect(ax)


## M2 at 98m¶

In [5]:
fig,axs = plt.subplots(1,2,figsize=(15,8))
const='M2'
isobaths=[5,20,90, 110]
sc=0.05
bc.plot_CODAR_ellipse(axs[0],lons, lats, const, bc_struc, depths, grid,
baroclinic=True, depth_level=26, scale=sc, isobaths=isobaths)
bc.plot_CODAR_ellipse(axs[1],lons, lats, const, bt_struc, depths, grid, scale=sc, isobaths=isobaths, barotropic=True)
for ax in axs:
ax.set_xlim([lons[0,0]-0.23, lons[-1,-1]+0.2])
ax.set_ylim([lats[0,0]-0.05, lats[-1,-1]+0.01])
viz_tools.set_aspect(ax)


## M2 147m¶

In [6]:
fig,axs = plt.subplots(1,2,figsize=(15,8))
const='M2'
isobaths=[5,20,90, 140]
sc=0.05
bc.plot_CODAR_ellipse(axs[0],lons, lats, const, bc_struc, depths, grid,
baroclinic=True, depth_level=28, scale=sc, isobaths=isobaths)
bc.plot_CODAR_ellipse(axs[1],lons, lats, const, bt_struc, depths, grid, scale=sc, isobaths=isobaths, barotropic=True)
for ax in axs:
ax.set_xlim([lons[0,0]-0.23, lons[-1,-1]+0.2])
ax.set_ylim([lats[0,0]-0.05, lats[-1,-1]+0.01])
viz_tools.set_aspect(ax)


# Phase¶

An attempt at comparing the baroclinic and barotropic phase

In [7]:
def plot_phase(ax, lons, lats, const, datastruc, baroclinic=False, depth_level = 0, barotropic = False):
"""Plot the phase stored in a matalb datastruc"""
major, minor, pha, inc = bc.get_constituent(const, datastruc)
if baroclinic:
pha = pha[:,:,depth_level]
title_str = 'baroclinic {0:.3g} m'.format(depths[depth_level][0])
elif barotropic:
title_str = 'barotropic'
else:
title_str = 'surface'

mesh=ax.pcolormesh(lons, lats, pha, vmin=0, vmax=360, cmap = 'hsv')
cbar = plt.colorbar(mesh, ax=ax)
cbar.set_label('Phase (deg wrt GMT)')

ax.set_xlim([lons[0,0]-0.23, lons[-1,-1]+0.2])
ax.set_ylim([lats[0,0]-0.1, lats[-1,-1]+0.04])
ax.set_ylabel('Latitude (degrees N)')
ax.set_xlabel('Longitude (degrees W)')

viz_tools.plot_coastline(ax, grid, coords='map', isobath=5)
viz_tools.plot_coastline(ax, grid, coords='map', isobath=20)
viz_tools.set_aspect(ax)

ax.set_title('{} {} phase'.format(const, title_str))

In [8]:
fig,axs = plt.subplots(1,3,figsize=(15,4))
const='M2'
plot_phase(axs[0],lons, lats, const, bc_struc, baroclinic=True, depth_level=0)
plot_phase(axs[1],lons, lats, const, bt_struc, barotropic = True)
plot_phase(axs[2],lons, lats, const, surface_struc)


The large baroclinic phase discontinuity (green area) is about 180 and results from a 180 deg shift in the inclination. Over the banks, the baroclinic phase is delayed when compared to the baroptropic phase. But, the barotopic and baroclinic currents are also in very different directions.

Idea - rotate baroclinic ellipse onto the barotropic major/minor axis. Look at the phase aligned with the barotropic major axis.

Que