import matplotlib.pylab as plt
import numpy as np
import scipy.io as sio
import netCDF4 as nc
from nowcast import (research_VENUS)
from salishsea_tools import viz_tools
import baroclinic as bc
import os
%matplotlib inline
strucs_notmasked = {}
path = '/ocean/nsoontie/MEOPAR/TidalEllipseData/'
names_notmasked = { 'CODAR': 'CODAR/CODAR_region_baroclinic_20141126_20150426.mat',
'BP': 'BP_region_baroclinic_20141126_20150426.mat',
'VictoriaSill': 'VictoriaSill_region_baroclinic_20141126_20150426.mat',
'JuandeFuca': 'JuandeFuca_region_baroclinic_20141126_20150426.mat'
}
for name in names_notmasked:
data = sio.loadmat(os.path.join(path, names_notmasked[name]))
strucs_notmasked[name] = data['datastruc']
strucs = {}
path = '/ocean/nsoontie/MEOPAR/TidalEllipseData/'
names = { 'CODAR': 'CODAR/CODAR_region_baroclinic_20141126_20150426_masked.mat',
'BP': 'BP_region_baroclinic_20141126_20150426_masked.mat',
'VictoriaSill': 'VictoriaSill_region_baroclinic_20141126_20150426_masked.mat',
'JuandeFuca': 'JuandeFuca_region_baroclinic_20141126_20150426_masked.mat'
}
for name in names:
data = sio.loadmat(os.path.join(path, names[name]))
strucs[name] = data['datastruc']
fig,axs=plt.subplots(1,2, figsize=(15,8))
d=0
count=0
const = 'MK3'
vmax=0.2
for name in names:
ax=axs[0]
major, minor, phase , inc= bc.get_constituent(const, strucs[name])
lons = strucs[name]['lons'][0,0]
lats = strucs[name]['lats'][0,0]
mesh = ax.pcolormesh(lons, lats, major[:,:,d],vmin=0, vmax=vmax)
if count==0:
cbar = plt.colorbar(mesh, ax=ax)
cbar.set_label('{} Major [m/s]'.format(const))
ax.set_title('{} surface baroclinic - new depth averaging'.format(const))
ax.set_xlim([-124,-122.5])
ax.set_ylim([48,49.3])
ax=axs[1]
major, minor, phase , inc= bc.get_constituent(const, strucs_notmasked[name])
lons = strucs_notmasked[name]['lons'][0,0]
lats = strucs_notmasked[name]['lats'][0,0]
mesh = ax.pcolormesh(lons, lats, major[:,:,d],vmin=0, vmax=vmax)
if count==0:
cbar = plt.colorbar(mesh, ax=ax)
cbar.set_label('{} Major [m/s]'.format(const))
ax.set_title('{} surface baroclinic - old depth averaging'.format(const))
count=count+1
ax.set_xlim([-124,-122.5])
ax.set_ylim([48,49.3])
fig,axs=plt.subplots(1,2, figsize=(15,8))
d=0
count=0
const = 'M2'
vmax=0.2
for name in names:
ax=axs[0]
major, minor, phase , inc= bc.get_constituent(const, strucs[name])
lons = strucs[name]['lons'][0,0]
lats = strucs[name]['lats'][0,0]
mesh = ax.pcolormesh(lons, lats, major[:,:,d],vmin=0, vmax=vmax)
if count==0:
cbar = plt.colorbar(mesh, ax=ax)
cbar.set_label('{} Major [m/s]'.format(const))
ax.set_title('{} surface baroclinic - new depth averaging'.format(const))
ax.set_xlim([-124,-122.5])
ax.set_ylim([48,49.3])
ax=axs[1]
major, minor, phase , inc= bc.get_constituent(const, strucs_notmasked[name])
lons = strucs_notmasked[name]['lons'][0,0]
lats = strucs_notmasked[name]['lats'][0,0]
mesh = ax.pcolormesh(lons, lats, major[:,:,d],vmin=0, vmax=vmax)
if count==0:
cbar = plt.colorbar(mesh, ax=ax)
cbar.set_label('{} Major [m/s]'.format(const))
ax.set_title('{} surface baroclinic - old depth averaging'.format(const))
count=count+1
ax.set_xlim([-124,-122.5])
ax.set_ylim([48,49.3])
fig,axs=plt.subplots(1,2, figsize=(15,8))
d=0
count=0
const = 'K1'
vmax=0.2
for name in names:
ax=axs[0]
major, minor, phase , inc= bc.get_constituent(const, strucs[name])
lons = strucs[name]['lons'][0,0]
lats = strucs[name]['lats'][0,0]
mesh = ax.pcolormesh(lons, lats, major[:,:,d],vmin=0, vmax=vmax)
if count==0:
cbar = plt.colorbar(mesh, ax=ax)
cbar.set_label('{} Major [m/s]'.format(const))
ax.set_title('{} surface baroclinic - new depth averaging'.format(const))
ax.set_xlim([-124,-122.5])
ax.set_ylim([48,49.3])
ax=axs[1]
major, minor, phase , inc= bc.get_constituent(const, strucs_notmasked[name])
lons = strucs_notmasked[name]['lons'][0,0]
lats = strucs_notmasked[name]['lats'][0,0]
mesh = ax.pcolormesh(lons, lats, major[:,:,d],vmin=0, vmax=vmax)
if count==0:
cbar = plt.colorbar(mesh, ax=ax)
cbar.set_label('{} Major [m/s]'.format(const))
ax.set_title('{} surface baroclinic - old depth averaging'.format(const))
count=count+1
ax.set_xlim([-124,-122.5])
ax.set_ylim([48,49.3])