from matplotlib.path import Path
%matplotlib inline
import matplotlib.pyplot as plt
import netCDF4 as nc
import numpy as np
import matplotlib.patches as patches
from salishsea_tools import viz_tools, geo_tools, tidetools
from bathy_helpers import *
grid = nc.Dataset('/data/vdo/MEOPAR/NEMO-forcing/grid/bathymetry_201702.nc')
fig, ax = plt.subplots(1,1, figsize=(16,12))
ax.pcolormesh(grid.variables['Bathymetry'][:])
ax.set_ylim(650,800)
ax.set_xlim(100,150)
viz_tools.set_aspect(ax)
ax.add_patch(patches.Rectangle((120,735), 10, 15, fill=False, linewidth=3))
ax.grid('on')
fig, ax = plt.subplots(1,1, figsize=(16,12))
ax.pcolormesh(grid.variables['Bathymetry'][:])
#ax.set_ylim(650,800)
#ax.set_xlim(100,150)
viz_tools.set_aspect(ax)
ax.add_patch(patches.Rectangle((45,750), 90, 898-750, fill=False, linewidth=3))
ax.add_patch(patches.Rectangle((45+90,735), 180, 898-735, fill=False, linewidth=3))
ax.add_patch(patches.Rectangle((100,200), 298, 535, fill=False, linewidth=3))
ax.grid('on')
#plt.savefig('Boxes.png', bbox_inches='tight')
fig, ax = plt.subplots(1,1, figsize=(16,12))
ax.pcolormesh(grid.variables['Bathymetry'][:])
ax.set_ylim(590,670)
ax.set_xlim(115,135)
viz_tools.set_aspect(ax)
ax.add_patch(patches.Rectangle((118,598), 15, 59, fill=False, linewidth=3))
ax.add_patch(patches.Rectangle((120,598), 13, 10, fill=False, linewidth=3))
<matplotlib.patches.Rectangle at 0x7f8da834ca58>
fig,ax= plt.subplots(1,1)
l = 743
ax.plot(Jul_lont[l,:], Jul_latt[l,:], 'r.')
viz_tools.plot_land_mask(ax, grid, coords='map')
#plt.savefig('Final_destination.png', bbox_inches='tight')
fig,ax= plt.subplots(1,1)
l = 743
ax.plot(Oct_lont[l,:], Oct_latt[l,:], 'r.')
viz_tools.plot_land_mask(ax, grid, coords='map')
<matplotlib.contour.QuadContourSet at 0x7f8da850a9e8>
fig,ax= plt.subplots(1,1)
l = 743
ax.plot(Jan_lont[l,:], Jan_latt[l,:], 'r.')
viz_tools.plot_land_mask(ax, grid, coords='map')
<matplotlib.contour.QuadContourSet at 0x7f8da844eba8>
fig,ax= plt.subplots(1,1)
l = 719
ax.plot(Apr_lont[l,:], Apr_latt[l,:], 'r.')
viz_tools.plot_land_mask(ax, grid, coords='map')
<matplotlib.contour.QuadContourSet at 0x7f8da8614550>
def still_inside(il, ir, jl, jr, lont, latt):
p = makebox(glamfe,gphife,il,ir,jl,jr)
poly = path.Path(p, closed=True)
time, particles = lont.shape
number_of_particles = np.zeros(time)
for l in range(time):
cx = lont[l,:]
cy = latt[l,:]
pts = np.array([cx,cy]).T
test = poly.contains_points(pts)
number_of_particles[l]= sum(test) / particles
return number_of_particles
def deep_particles(lont,latt,init_z, il, ir, jl, jr):
mask = lont[:].mask
p = makebox(glamfe,gphife,il,ir,jl,jr)
poly = path.Path(p, closed=True)
time, particles = lont.shape
number_of_particles = np.zeros(time)
index_deep_particles=[]
for n in range(particles):
if init_z[n] > 6:
index_deep_particles.append(n)
length_of_deep_particles = len(index_deep_particles)
number_of_deep_particles = np.zeros(time)
for n in range(time):
for m in index_deep_particles:
if (mask[n,m]) == False:
tf = poly.contains_point(np.array((lont[n,m], latt[n,m])).T)
if tf == True:
number_of_deep_particles[n] = number_of_deep_particles[n] + 1
return (number_of_deep_particles / length_of_deep_particles)
def shallow_particles(lont,latt,init_z, il, ir, jl, jr):
mask = lont[:].mask
p = makebox(glamfe,gphife,il,ir,jl,jr)
poly = path.Path(p, closed=True)
time, particles = lont.shape
number_of_particles = np.zeros(time)
index_shallow_particles=[]
for n in range(particles):
if init_z[n] < 6:
index_shallow_particles.append(n)
length_of_shallow_particles = len(index_shallow_particles)
number_of_shallow_particles = np.zeros(time)
for n in range(time):
for m in index_shallow_particles:
if (mask[n,m]) == False:
tf = poly.contains_point(np.array((lont[n,m], latt[n,m])).T)
if tf == True:
number_of_shallow_particles[n] = number_of_shallow_particles[n] + 1
return (number_of_shallow_particles / length_of_shallow_particles)
fig, ax = plt.subplots(1,1, figsize=(16,12))
ax.pcolormesh(grid.variables['Bathymetry'][:])
ax.set_ylim(650,800)
ax.set_xlim(100,150)
viz_tools.set_aspect(ax)
ax.add_patch(patches.Rectangle((120,735), 10, 15, fill=False, linewidth=3))
ax.grid('on')
Jul_CR_all = still_inside(120, 130, 735, 750, Jul_lont, Jul_latt)
Oct_CR_all = still_inside(120, 130, 735, 750, Oct_lont, Oct_latt)
Jan_CR_all = still_inside(120, 130, 735, 750, Jan_lont, Jan_latt)
Apr_CR_all = still_inside(120, 130, 735, 750, Apr_lont, Apr_latt)
fig,ax = plt.subplots(2,2,figsize=(12,12))
ax[0,0].plot(range(744), Jul_CR_all, 'r.')
ax[0,0].grid('on')
ax[0,0].set_title('July 2016')
ax[0,1].plot(range(744), Oct_CR_all, 'r.')
ax[0,1].grid('on')
ax[0,1].set_title('October 2016')
ax[1,0].plot(range(744), Jan_CR_all, 'r.')
ax[1,0].grid('on')
ax[1,0].set_title('January 2017')
ax[1,1].plot(range(720), Apr_CR_all, 'r.')
ax[1,1].grid('on')
ax[1,1].set_title('April 2017')
<matplotlib.text.Text at 0x7f8d9b166048>
Jul_CR_deep = deep_particles(Jul_lont, Jul_latt, Jul.variables['init_z'], 120, 130, 735, 750)
Oct_CR_deep = deep_particles(Oct_lont, Oct_latt, Oct.variables['init_z'], 120, 130, 735, 750)
Jan_CR_deep = deep_particles(Jan_lont, Jan_latt, Jan.variables['init_z'], 120, 130, 735, 750)
Apr_CR_deep = deep_particles(Apr_lont, Apr_latt, Apr.variables['init_z'], 120, 130, 735, 750)
fig,ax = plt.subplots(2,2,figsize=(12,12))
ax[0,0].plot(range(744), Jul_CR_deep, 'r.')
ax[0,0].grid('on')
ax[0,0].set_title('July 2016')
ax[0,1].plot(range(744), Oct_CR_deep, 'r.')
ax[0,1].grid('on')
ax[0,1].set_title('October 2016')
ax[1,0].plot(range(744), Jan_CR_deep, 'r.')
ax[1,0].grid('on')
ax[1,0].set_title('January 2017')
ax[1,1].plot(range(720), Apr_CR_deep, 'r.')
ax[1,1].grid('on')
ax[1,1].set_title('April 2017')
<matplotlib.text.Text at 0x7f8d9aecb208>
Jul_CR_shallow = shallow_particles(Jul_lont, Jul_latt, Jul.variables['init_z'], 120, 130, 735, 750)
Oct_CR_shallow = shallow_particles(Oct_lont, Oct_latt, Oct.variables['init_z'], 120, 130, 735, 750)
Jan_CR_shallow = shallow_particles(Jan_lont, Jan_latt, Jan.variables['init_z'], 120, 130, 735, 750)
Apr_CR_shallow = shallow_particles(Apr_lont, Apr_latt, Apr.variables['init_z'], 120, 130, 735, 750)
fig,ax = plt.subplots(2,2,figsize=(12,12))
ax[0,0].plot(range(744), Jul_CR_shallow, 'r.')
ax[0,0].grid('on')
ax[0,0].set_title('July 2016')
ax[0,1].plot(range(744), Oct_CR_shallow, 'r.')
ax[0,1].grid('on')
ax[0,1].set_title('October 2016')
ax[1,0].plot(range(744), Jan_CR_shallow, 'r.')
ax[1,0].grid('on')
ax[1,0].set_title('January 2017')
ax[1,1].plot(range(720), Apr_CR_shallow, 'r.')
ax[1,1].grid('on')
ax[1,1].set_title('April 2017')
<matplotlib.text.Text at 0x7f8d9ace1198>
fig, ax = plt.subplots(1,1, figsize=(16,12))
ax.pcolormesh(grid.variables['Bathymetry'][:])
viz_tools.set_aspect(ax)
ax.add_patch(patches.Rectangle((45,750), 90, 898-750, fill=False, linewidth=3))
<matplotlib.patches.Rectangle at 0x7f8da06aa710>
Jul_NW_all = still_inside(45, 135, 750, 897, Jul_lont, Jul_latt)
Oct_NW_all = still_inside(45, 135, 750, 897, Oct_lont, Oct_latt)
Jan_NW_all = still_inside(45, 135, 750, 897, Jan_lont, Jan_latt)
Apr_NW_all = still_inside(45, 135, 750, 897, Apr_lont, Apr_latt)
fig,ax = plt.subplots(2,2,figsize=(12,12))
ax[0,0].plot(range(744), Jul_NW_all, 'r.')
ax[0,0].grid('on')
ax[0,0].set_title('July 2016')
ax[0,1].plot(range(744), Oct_NW_all, 'r.')
ax[0,1].grid('on')
ax[0,1].set_title('October 2016')
ax[1,0].plot(range(744), Jan_NW_all, 'r.')
ax[1,0].grid('on')
ax[1,0].set_title('January 2017')
ax[1,1].plot(range(720), Apr_NW_all, 'r.')
ax[1,1].grid('on')
ax[1,1].set_title('April 2017')
<matplotlib.text.Text at 0x7f8da1979240>
Jul_NW_deep = deep_particles(Jul_lont, Jul_latt, Jul.variables['init_z'], 45, 135, 750, 897)
Jul_NW_deep[:5]
array([ 0. , 0.7881137, 1. , 1. , 1. ])
Oct_NW_deep = deep_particles(Oct_lont, Oct_latt, Oct.variables['init_z'], 45, 135, 750, 897)
Jan_NW_deep = deep_particles(Jan_lont, Jan_latt, Jan.variables['init_z'], 45, 135, 750, 897)
Apr_NW_deep = deep_particles(Apr_lont, Apr_latt, Apr.variables['init_z'], 45, 135, 750, 897)
fig,ax = plt.subplots(2,2,figsize=(12,12))
ax[0,0].plot(range(744), Jul_NW_deep, 'r.')
ax[0,0].grid('on')
ax[0,0].set_title('July 2016')
ax[0,1].plot(range(744), Oct_NW_deep, 'r.')
ax[0,1].grid('on')
ax[0,1].set_title('October 2016')
ax[1,0].plot(range(744), Jan_NW_deep, 'r.')
ax[1,0].grid('on')
ax[1,0].set_title('January 2017')
ax[1,1].plot(range(720), Apr_NW_deep, 'r.')
ax[1,1].grid('on')
ax[1,1].set_title('April 2017')
<matplotlib.text.Text at 0x7f8da0cda8d0>
Jul_NW_shallow = shallow_particles(Jul_lont, Jul_latt, Jul.variables['init_z'], 45, 135, 750, 897)
Oct_NW_shallow = shallow_particles(Oct_lont, Oct_latt, Oct.variables['init_z'], 45, 135, 750, 897)
Jan_NW_shallow = shallow_particles(Jan_lont, Jan_latt, Jan.variables['init_z'], 45, 135, 750, 897)
Apr_NW_shallow = shallow_particles(Apr_lont, Apr_latt, Apr.variables['init_z'], 45, 135, 750, 897)
fig,ax = plt.subplots(2,2,figsize=(12,12))
ax[0,0].plot(range(744), Jul_NW_shallow, 'r.')
ax[0,0].grid('on')
ax[0,0].set_title('July 2016')
ax[0,1].plot(range(744), Oct_NW_shallow, 'r.')
ax[0,1].grid('on')
ax[0,1].set_title('October 2016')
ax[1,0].plot(range(744), Jan_NW_shallow, 'r.')
ax[1,0].grid('on')
ax[1,0].set_title('January 2017')
ax[1,1].plot(range(720), Apr_NW_shallow, 'r.')
ax[1,1].grid('on')
ax[1,1].set_title('April 2017')
<matplotlib.text.Text at 0x7f8da0a66198>
fig, ax = plt.subplots(1,1, figsize=(16,12))
ax.pcolormesh(grid.variables['Bathymetry'][:])
viz_tools.set_aspect(ax)
ax.add_patch(patches.Rectangle((45+90,735), 180, 898-735, fill=False, linewidth=3))
ax.grid('on')
Jul_NE_all = still_inside(135, 315, 735, 897, Jul_lont, Jul_latt)
Oct_NE_all = still_inside(135, 315, 735, 897, Oct_lont, Oct_latt)
Jan_NE_all = still_inside(135, 315, 735, 897, Jan_lont, Jan_latt)
Apr_NE_all = still_inside(135, 315, 735, 897, Apr_lont, Apr_latt)
fig,ax = plt.subplots(2,2,figsize=(12,12))
ax[0,0].plot(range(744), Jul_NE_all, 'r.')
ax[0,0].grid('on')
ax[0,0].set_title('July 2016')
ax[0,1].plot(range(744), Oct_NE_all, 'r.')
ax[0,1].grid('on')
ax[0,1].set_title('October 2016')
ax[1,0].plot(range(744), Jan_NE_all, 'r.')
ax[1,0].grid('on')
ax[1,0].set_title('January 2017')
ax[1,1].plot(range(720), Apr_NE_all, 'r.')
ax[1,1].grid('on')
ax[1,1].set_title('April 2017')
<matplotlib.text.Text at 0x7f8da16f62b0>
Jul_NE_deep = deep_particles(Jul_lont, Jul_latt, Jul.variables['init_z'], 135, 315, 735, 897)
Oct_NE_deep = deep_particles(Oct_lont, Oct_latt, Oct.variables['init_z'], 135, 315, 735, 897)
Jan_NE_deep = deep_particles(Jan_lont, Jan_latt, Jan.variables['init_z'], 135, 315, 735, 897)
Apr_NE_deep = deep_particles(Apr_lont, Apr_latt, Apr.variables['init_z'], 135, 315, 735, 897)
fig,ax = plt.subplots(2,2,figsize=(12,12))
ax[0,0].plot(range(744), Jul_NE_deep, 'r.')
ax[0,0].grid('on')
ax[0,0].set_title('July 2016')
ax[0,1].plot(range(744), Oct_NE_deep, 'r.')
ax[0,1].grid('on')
ax[0,1].set_title('October 2016')
ax[1,0].plot(range(744), Jan_NE_deep, 'r.')
ax[1,0].grid('on')
ax[1,0].set_title('January 2017')
ax[1,1].plot(range(720), Apr_NE_deep, 'r.')
ax[1,1].grid('on')
ax[1,1].set_title('April 2017')
<matplotlib.text.Text at 0x7f8da04f4390>
Jul_NE_shallow = shallow_particles(Jul_lont, Jul_latt, Jul.variables['init_z'], 135, 315, 735, 897)
Oct_NE_shallow = shallow_particles(Oct_lont, Oct_latt, Oct.variables['init_z'], 135, 315, 735, 897)
Jan_NE_shallow = shallow_particles(Jan_lont, Jan_latt, Jan.variables['init_z'], 135, 315, 735, 897)
Apr_NE_shallow = shallow_particles(Apr_lont, Apr_latt, Apr.variables['init_z'], 135, 315, 735, 897)
fig,ax = plt.subplots(2,2,figsize=(12,12))
ax[0,0].plot(range(744), Jul_NE_shallow, 'r.')
ax[0,0].grid('on')
ax[0,0].set_title('July 2016')
ax[0,1].plot(range(744), Oct_NE_shallow, 'r.')
ax[0,1].grid('on')
ax[0,1].set_title('October 2016')
ax[1,0].plot(range(744), Jan_NE_shallow, 'r.')
ax[1,0].grid('on')
ax[1,0].set_title('January 2017')
ax[1,1].plot(range(720), Apr_NE_shallow, 'r.')
ax[1,1].grid('on')
ax[1,1].set_title('April 2017')
<matplotlib.text.Text at 0x7f8da0282fd0>
fig, ax = plt.subplots(1,1, figsize=(16,12))
ax.pcolormesh(grid.variables['Bathymetry'][:])
viz_tools.set_aspect(ax)
ax.add_patch(patches.Rectangle((100,200), 298, 535, fill=False, linewidth=3))
ax.grid('on')
Jul_S_all = still_inside(100, 397, 200, 735, Jul_lont, Jul_latt)
Oct_S_all = still_inside(100, 397, 200, 735, Oct_lont, Oct_latt)
Jan_S_all = still_inside(100, 397, 200, 735, Jan_lont, Jan_latt)
Apr_S_all = still_inside(100, 397, 200, 735, Apr_lont, Apr_latt)
fig,ax = plt.subplots(2,2,figsize=(12,12))
ax[0,0].plot(range(744), Jul_S_all, 'r.')
ax[0,0].grid('on')
ax[0,0].set_title('July 2016')
ax[0,1].plot(range(744), Oct_S_all, 'r.')
ax[0,1].grid('on')
ax[0,1].set_title('October 2016')
ax[1,0].plot(range(744), Jan_S_all, 'r.')
ax[1,0].grid('on')
ax[1,0].set_title('January 2017')
ax[1,1].plot(range(720), Apr_S_all, 'r.')
ax[1,1].grid('on')
ax[1,1].set_title('April 2017')
<matplotlib.text.Text at 0x7f8da1473e10>
Jul_S_deep = deep_particles(Jul_lont, Jul_latt, Jul.variables['init_z'], 100, 397, 200, 735)
Oct_S_deep = deep_particles(Oct_lont, Oct_latt, Oct.variables['init_z'], 100, 397, 200, 735)
Jan_S_deep = deep_particles(Jan_lont, Jan_latt, Jan.variables['init_z'], 100, 397, 200, 735)
Apr_S_deep = deep_particles(Apr_lont, Apr_latt, Apr.variables['init_z'], 100, 397, 200, 735)
fig,ax = plt.subplots(2,2,figsize=(12,12))
ax[0,0].plot(range(744), Jul_S_deep, 'r.')
ax[0,0].grid('on')
ax[0,0].set_title('July 2016')
ax[0,1].plot(range(744), Oct_S_deep, 'r.')
ax[0,1].grid('on')
ax[0,1].set_title('October 2016')
ax[1,0].plot(range(744), Jan_S_deep, 'r.')
ax[1,0].grid('on')
ax[1,0].set_title('January 2017')
ax[1,1].plot(range(720), Apr_S_deep, 'r.')
ax[1,1].grid('on')
ax[1,1].set_title('April 2017')
<matplotlib.text.Text at 0x7f8d9bfdd860>
Jul_S_shallow = shallow_particles(Jul_lont, Jul_latt, Jul.variables['init_z'], 100, 397, 200, 735)
Oct_S_shallow = shallow_particles(Oct_lont, Oct_latt, Oct.variables['init_z'], 100, 397, 200, 735)
Jan_S_shallow = shallow_particles(Jan_lont, Jan_latt, Jan.variables['init_z'], 100, 397, 200, 735)
Apr_S_shallow = shallow_particles(Apr_lont, Apr_latt, Apr.variables['init_z'], 100, 397, 200, 735)
fig,ax = plt.subplots(2,2,figsize=(12,12))
ax[0,0].plot(range(744), Jul_S_shallow, 'r.')
ax[0,0].grid('on')
ax[0,0].set_title('July 2016')
ax[0,1].plot(range(744), Oct_S_shallow, 'r.')
ax[0,1].grid('on')
ax[0,1].set_title('October 2016')
ax[1,0].plot(range(744), Jan_S_shallow, 'r.')
ax[1,0].grid('on')
ax[1,0].set_title('January 2017')
ax[1,1].plot(range(720), Apr_S_shallow, 'r.')
ax[1,1].grid('on')
ax[1,1].set_title('April 2017')
<matplotlib.text.Text at 0x7f8d9bd58898>
fig, ax = plt.subplots(1,1, figsize=(16,12))
ax.pcolormesh(grid.variables['Bathymetry'][:])
ax.set_ylim(590,670)
ax.set_xlim(115,135)
viz_tools.set_aspect(ax)
ax.add_patch(patches.Rectangle((118,598), 15, 59, fill=False, linewidth=3))
<matplotlib.patches.Rectangle at 0x7f8d9a9b4978>
Jul_BS_all = still_inside(118, 133, 598, 657, Jul_lont, Jul_latt)
Oct_BS_all = still_inside(118, 133, 598, 657, Oct_lont, Oct_latt)
Jan_BS_all = still_inside(118, 133, 598, 657, Jan_lont, Jan_latt)
Apr_BS_all = still_inside(118, 133, 598, 657, Apr_lont, Apr_latt)
fig,ax = plt.subplots(2,2,figsize=(12,12))
ax[0,0].plot(range(744), Jul_BS_all, 'r.')
ax[0,0].grid('on')
ax[0,0].set_title('July 2016')
ax[0,1].plot(range(744), Oct_BS_all, 'r.')
ax[0,1].grid('on')
ax[0,1].set_title('October 2016')
ax[1,0].plot(range(744), Jan_BS_all, 'r.')
ax[1,0].grid('on')
ax[1,0].set_title('January 2017')
ax[1,1].plot(range(720), Apr_BS_all, 'r.')
ax[1,1].grid('on')
ax[1,1].set_title('April 2017')
<matplotlib.text.Text at 0x7f8da123c5f8>
Jul_BS_deep = deep_particles(Jul_lont, Jul_latt, Jul.variables['init_z'], 118, 133, 598, 657)
Oct_BS_deep = deep_particles(Oct_lont, Oct_latt, Oct.variables['init_z'], 118, 133, 598, 657)
Jan_BS_deep = deep_particles(Jan_lont, Jan_latt, Jan.variables['init_z'], 118, 133, 598, 657)
Apr_BS_deep = deep_particles(Apr_lont, Apr_latt, Apr.variables['init_z'], 118, 133, 598, 657)
fig,ax = plt.subplots(2,2,figsize=(12,12))
ax[0,0].plot(range(744), Jul_BS_deep, 'r.')
ax[0,0].grid('on')
ax[0,0].set_title('July 2016')
ax[0,1].plot(range(744), Oct_BS_deep, 'r.')
ax[0,1].grid('on')
ax[0,1].set_title('October 2016')
ax[1,0].plot(range(744), Jan_BS_deep, 'r.')
ax[1,0].grid('on')
ax[1,0].set_title('January 2017')
ax[1,1].plot(range(720), Apr_BS_deep, 'r.')
ax[1,1].grid('on')
ax[1,1].set_title('April 2017')
<matplotlib.text.Text at 0x7f8d9bb31240>
Jul_BS_shallow = shallow_particles(Jul_lont, Jul_latt, Jul.variables['init_z'], 118, 133, 598, 657)
Oct_BS_shallow = shallow_particles(Oct_lont, Oct_latt, Oct.variables['init_z'], 118, 133, 598, 657)
Jan_BS_shallow = shallow_particles(Jan_lont, Jan_latt, Jan.variables['init_z'], 118, 133, 598, 657)
Apr_BS_shallow = shallow_particles(Apr_lont, Apr_latt, Apr.variables['init_z'], 118, 133, 598, 657)
fig,ax = plt.subplots(2,2,figsize=(12,12))
ax[0,0].plot(range(744), Jul_BS_shallow, 'r.')
ax[0,0].grid('on')
ax[0,0].set_title('July 2016')
ax[0,1].plot(range(744), Oct_BS_shallow, 'r.')
ax[0,1].grid('on')
ax[0,1].set_title('October 2016')
ax[1,0].plot(range(744), Jan_BS_shallow, 'r.')
ax[1,0].grid('on')
ax[1,0].set_title('January 2017')
ax[1,1].plot(range(720), Apr_BS_shallow, 'r.')
ax[1,1].grid('on')
ax[1,1].set_title('April 2017')
<matplotlib.text.Text at 0x7f8d9b881e10>
fig, ax = plt.subplots(1,1, figsize=(16,12))
ax.pcolormesh(grid.variables['Bathymetry'][:])
ax.set_ylim(590,670)
ax.set_xlim(115,135)
viz_tools.set_aspect(ax)
ax.add_patch(patches.Rectangle((120,598), 13, 10, fill=False, linewidth=3))
<matplotlib.patches.Rectangle at 0x7f8d9a8c74e0>
Jul_DB_all = still_inside(120, 133, 598, 608, Jul_lont, Jul_latt)
Oct_DB_all = still_inside(120, 133, 598, 608, Oct_lont, Oct_latt)
Jan_DB_all = still_inside(120, 133, 598, 608, Jan_lont, Jan_latt)
Apr_DB_all = still_inside(120, 133, 598, 608, Apr_lont, Apr_latt)
fig,ax = plt.subplots(2,2,figsize=(12,12))
ax[0,0].plot(range(744), Jul_DB_all, 'r.')
ax[0,0].grid('on')
ax[0,0].set_title('July 2016')
ax[0,1].plot(range(744), Oct_DB_all, 'r.')
ax[0,1].grid('on')
ax[0,1].set_title('October 2016')
ax[1,0].plot(range(744), Jan_DB_all, 'r.')
ax[1,0].grid('on')
ax[1,0].set_title('January 2017')
ax[1,1].plot(range(720), Apr_DB_all, 'r.')
ax[1,1].grid('on')
ax[1,1].set_title('April 2017')
<matplotlib.text.Text at 0x7f8da0fc38d0>
Jul_DB_deep = deep_particles(Jul_lont, Jul_latt, Jul.variables['init_z'], 120, 133, 598, 608)
Oct_DB_deep = deep_particles(Oct_lont, Oct_latt, Oct.variables['init_z'], 120, 133, 598, 608)
Jan_DB_deep = deep_particles(Jan_lont, Jan_latt, Jan.variables['init_z'], 120, 133, 598, 608)
Apr_DB_deep = deep_particles(Apr_lont, Apr_latt, Apr.variables['init_z'], 120, 133, 598, 608)
fig,ax = plt.subplots(2,2,figsize=(12,12))
ax[0,0].plot(range(744), Jul_DB_deep, 'r.')
ax[0,0].grid('on')
ax[0,0].set_title('July 2016')
ax[0,1].plot(range(744), Oct_DB_deep, 'r.')
ax[0,1].grid('on')
ax[0,1].set_title('October 2016')
ax[1,0].plot(range(744), Jan_DB_deep, 'r.')
ax[1,0].grid('on')
ax[1,0].set_title('January 2017')
ax[1,1].plot(range(720), Apr_DB_deep, 'r.')
ax[1,1].grid('on')
ax[1,1].set_title('April 2017')
<matplotlib.text.Text at 0x7f8d9b617668>
Jul_DB_shallow = shallow_particles(Jul_lont, Jul_latt, Jul.variables['init_z'], 120, 133, 598, 608)
Oct_DB_shallow = shallow_particles(Oct_lont, Oct_latt, Oct.variables['init_z'], 120, 133, 598, 608)
Jan_DB_shallow = shallow_particles(Jan_lont, Jan_latt, Jan.variables['init_z'], 120, 133, 598, 608)
Apr_DB_shallow = shallow_particles(Apr_lont, Apr_latt, Apr.variables['init_z'], 120, 133, 598, 608)
fig,ax = plt.subplots(2,2,figsize=(12,12))
ax[0,0].plot(range(744), Jul_DB_shallow, 'r.')
ax[0,0].grid('on')
ax[0,0].set_title('July 2016')
ax[0,1].plot(range(744), Oct_DB_shallow, 'r.')
ax[0,1].grid('on')
ax[0,1].set_title('October 2016')
ax[1,0].plot(range(744), Jan_DB_shallow, 'r.')
ax[1,0].grid('on')
ax[1,0].set_title('January 2017')
ax[1,1].plot(range(720), Apr_DB_shallow, 'r.')
ax[1,1].grid('on')
ax[1,1].set_title('April 2017')
<matplotlib.text.Text at 0x7f8d9b386d68>