/data/dlatorne/MEOPAR/SalishSea/nowcast/ for 24-26sep14 and 27sep3oct14
/data/dlatorne/MEOPAR/SalishSea/nowcast/ for 25-26oct14 and 27/28/29/30/31oct14 and 01/02/03nov14
import matplotlib.pyplot as plt
import netCDF4 as nc
import numpy as np
import matplotlib.cm as cm
from salishsea_tools import (nc_tools,viz_tools,tidetools)
%matplotlib inline
Checking dimensions
tracers = nc.Dataset('/data/dlatorne/MEOPAR/SalishSea/nowcast/24-26sep14/SalishSea_1h_20140924_20140926_grid_T.nc')
sal = tracers.variables['vosaline']
sal.shape
(72, 40, 898, 398)
tracers = nc.Dataset('/data/dlatorne/MEOPAR/SalishSea/nowcast/27sep3oct14/SalishSea_1h_20140927_20141003_grid_T.nc')
sal = tracers.variables['vosaline']
sal.shape
(168, 40, 898, 398)
tracers = nc.Dataset('/data/dlatorne/MEOPAR/SalishSea/nowcast/25-26oct14/SalishSea_1h_20141025_20141026_grid_T.nc')
sal = tracers.variables['vosaline']
sal.shape
(48, 40, 898, 398)
tracers = nc.Dataset('/data/dlatorne/MEOPAR/SalishSea/nowcast/27oct14/SalishSea_1h_20141027_20141027_grid_T.nc')
sal = tracers.variables['vosaline']
sal.shape
(24, 40, 898, 398)
grid = nc.Dataset('/ocean/imachuca/MEOPAR/NEMO-forcing/grid/bathy_meter_SalishSea2.nc','r')
nc_tools.show_variables(grid)
lats = grid.variables['nav_lat']
lons = grid.variables['nav_lon']
bathy = grid.variables['Bathymetry']
bath, X, Y = tidetools.get_bathy_data(grid)
[u'nav_lon', u'nav_lat', u'Bathymetry']
thal1 = nc.Dataset('/ocean/imachuca/MEOPAR/Ariane/results/thalweg_nowcast/depth/sept/ariane_trajectories_qualitative.nc','r')
lon1=thal1.variables['traj_lon']
lat1=thal1.variables['traj_lat']
dep1=thal1.variables['traj_depth']
x1=thal1.variables['init_x']
y1=thal1.variables['init_y']
t1=thal1.variables['traj_time']
nc_tools.show_variables(thal1)
lon1.shape
[u'init_x', u'init_y', u'init_z', u'init_t', u'init_age', u'init_transp', u'final_x', u'final_y', u'final_z', u'final_t', u'final_age', u'final_transp', u'traj_lon', u'traj_lat', u'traj_depth', u'traj_time']
(240, 7)
thal2 = nc.Dataset('/ocean/imachuca/MEOPAR/Ariane/results/thalweg_nowcast/depth/oct/ariane_trajectories_qualitative.nc','r')
lon2=thal2.variables['traj_lon']
lat2=thal2.variables['traj_lat']
dep2=thal2.variables['traj_depth']
x2=thal2.variables['init_x']
y2=thal2.variables['init_y']
t2=thal2.variables['traj_time']
nc_tools.show_variables(thal2)
lon2.shape
[u'init_x', u'init_y', u'init_z', u'init_t', u'init_age', u'init_transp', u'final_x', u'final_y', u'final_z', u'final_t', u'final_age', u'final_transp', u'traj_lon', u'traj_lat', u'traj_depth', u'traj_time']
(192, 7)
fig, axs =plt.subplots(7,3,figsize=(20,70))
m=np.arange(7)
land_colour = 'burlywood'
cmap = plt.get_cmap('Blues')
for M,ax in zip(m,axs[:,0]):
minx = min(min(lon1[:,M]), min(lon2[:,M]))-0.1
miny = min(min(lat1[:,M]), min(lat2[:,M]))-0.05
maxx = max(max(lon1[:,M]), max(lon2[:,M]))+0.1
maxy = max(max(lat1[:,M]), max(lat2[:,M]))+0.05
viz_tools.plot_land_mask(ax,grid,coords='map',color=land_colour)
mesh = ax.pcolormesh(lons[:], lats[:], bathy[:], cmap=cmap)
ax.plot(lon1[0,M],lat1[0,M],color='red',marker='s',markersize=10)
ax.plot(lon1[1:,M],lat1[1:,M], color='DarkMagenta', label='Sep')
ax.plot(lon2[1:,M],lat2[1:,M], color='green', label='Oct')
ax.set_title('Sep 24 - Oct 3, Oct 27 - Nov 3')
ax.set_xlim([minx,maxx])
ax.set_ylim([miny,maxy])
ax.legend(loc = 0, numpoints = 1)
for M,ax in zip(m,axs[:,1]):
viz_tools.plot_land_mask(ax,grid,coords='map',color=land_colour)
mesh = ax.pcolormesh(lons[:], lats[:], bathy[:], cmap=cmap)
ax.plot(lon1[0,M],lat1[0,M],color='red',marker='s',markersize=10)
ax.plot(lon1[1:,M],lat1[1:,M],color='DarkMagenta', label='Sep')
ax.plot(lon2[1:,M],lat2[1:,M],color='green', label='Oct')
ax.set_title('Sep 24 - Oct 3, Oct 27 - Nov 3')
ax.set_xlim([-124.8,-122.2])
ax.set_ylim([48,50])
ax.legend(loc = 0, numpoints = 1)
for M,ax in zip(m,axs[:,2]):
ax.plot(t1[:,M], dep1[:,M]*-1, '-', color='DarkMagenta')
ax.plot(t2[:,M], dep2[:,M]*-1, '-', color='green')
ax.set_title('Depths')
ax.set_ylim(300, 0)