Understanding the sequential function in Ariane

Imports

In [1]:
import netCDF4 as NC
import numpy as np

import matplotlib.pyplot as plt
import matplotlib.cm as cm
from IPython.core.display import Image
import datetime as dt


from salishsea_tools import (nc_tools,tidetools,viz_tools,stormtools)

%matplotlib inline

Data

In [2]:
grid = NC.Dataset('/ocean/imachuca/MEOPAR/NEMO-forcing/grid/bathy_meter_SalishSea2.nc','r')
bathy, X, Y = tidetools.get_bathy_data(grid)
lats = grid.variables['nav_lat']
lons = grid.variables['nav_lon']
bath = grid.variables['Bathymetry']
In [3]:
o1 = NC.Dataset('/ocean/imachuca/MEOPAR/Ariane/results/drifter_compare/oct8/drop3/1/ariane_trajectories_qualitative.nc','r')
lon1=o1.variables['traj_lon']
lat1=o1.variables['traj_lat']
In [4]:
o2 = NC.Dataset('/ocean/imachuca/MEOPAR/Ariane/results/sequential/oct4t10/ariane_trajectories_qualitative.nc','r')
lon2=o2.variables['traj_lon']
lat2=o2.variables['traj_lat']
In [5]:
o3 = NC.Dataset('/ocean/imachuca/MEOPAR/Ariane/results/sequential/oct4t10/diff_cycle/ariane_trajectories_qualitative.nc','r')
lon3=o3.variables['traj_lon']
lat3=o3.variables['traj_lat']
In [6]:
five = NC.Dataset('/ocean/imachuca/MEOPAR/Ariane/results/sequential/sep19t20/original/ariane_trajectories_qualitative.nc','r')
lon5=five.variables['traj_lon']
lat5=five.variables['traj_lat']
In [7]:
o4 = NC.Dataset('/ocean/imachuca/MEOPAR/Ariane/results/sequential/sep19t20/extrapolate/ariane_trajectories_qualitative.nc','r')
lon4=o4.variables['traj_lon']
lat4=o4.variables['traj_lat']
In [8]:
o6 = NC.Dataset('/ocean/imachuca/MEOPAR/Ariane/results/sequential/sep19t20/cyc1/ariane_trajectories_qualitative.nc','r')
lon6=o6.variables['traj_lon']
lat6=o6.variables['traj_lat']
In [9]:
o7 = NC.Dataset('/ocean/imachuca/MEOPAR/Ariane/results/sequential/sep19t20/cyc2/ariane_trajectories_qualitative.nc','r')
lon7=o7.variables['traj_lon']
lat7=o7.variables['traj_lat']
In [10]:
o8 = NC.Dataset('/ocean/nsoontie/MEOPAR/Ariane/results/sequential/ariane_trajectories_qualitative.nc','r')
lon8=o8.variables['traj_lon']
lat8=o8.variables['traj_lat']

Comparison

In [11]:
fig, ax = plt.subplots(1, 1, figsize=(10, 8))
viz_tools.plot_coastline(ax,grid,coords='map')
ax.set_xlim([-123.6,-123])
ax.set_ylim([48.6,49.4])
ax.scatter(lon1[1:,:],lat1[1:,:],color='DodgerBlue',marker='o',label='Standard: no maxcycles')
ax.scatter(lon1[0,:],lat1[0,:],color='red',marker='s')

ax.scatter(lon2[1:,:],lat2[1:,:],color='Indigo',marker='o',label='Sequential: maxcycles=1')
ax.scatter(lon2[0,:],lat2[0,:],color='red',marker='s')

ax.scatter(lon3[1:,:],lat3[1:,:],color='MediumVioletRed',marker='o',label='Sequential: maxcycles=2')
ax.scatter(lon3[0,:],lat3[0,:],color='red',marker='s')

ax.legend()

ax.set_title('October 8 Drifter')
Out[11]:
<matplotlib.text.Text at 0x7f7ef41c6250>
In [12]:
fig, ax = plt.subplots(1, 1, figsize=(15, 10))
viz_tools.plot_coastline(ax,grid,coords='map')
ax.set_xlim([-123.5,-123.35])
ax.set_ylim([48.97,49.12])
ax.scatter(lon5[1:,:],lat5[1:,:],color='DodgerBlue',marker='o',label='Standard: no maxcycles, nb_out=12',s=550)
ax.scatter(lon5[0,:],lat5[0,:],color='red',marker='s')
ax.scatter(lon4[1:,:],lat4[1:,:],color='OrangeRed',marker='o',label='Standard: no maxcycles, nb_out=24',s=300)
ax.scatter(lon4[0,:],lat4[0,:],color='red',marker='s')
ax.scatter(lon6[1:,:],lat6[1:,:],color='Indigo',marker='o',label='Sequential: maxcycles=1, nb_out = 24', s=150)
ax.scatter(lon6[0,:],lat6[0,:],color='red',marker='s')
ax.scatter(lon7[1:,:],lat7[1:,:],color='yellow',marker='o',label='Sequential: maxcycles=2, nb_out = 24')
ax.scatter(lon7[0,:],lat7[0,:],color='red',marker='s')

ax.legend()

ax.set_title('September 20 Drifter')
plt.suptitle('Note: input only allows for nb_out < 13', fontsize=15)
Out[12]:
<matplotlib.text.Text at 0x7f7ef3ffee90>
In [13]:
fig, ax = plt.subplots(1, 1, figsize=(10, 8))
viz_tools.plot_coastline(ax,grid,coords='map')
ax.set_xlim([-123.8,-123])
ax.set_ylim([48.6,49.4])

ax.scatter(lon8[0,:],lat8[0,:],color='red',marker='s')
ax.scatter(lon8[1:25:1,:],lat8[1:25:1,:],color='Indigo',marker='o',label='Sequential: Nov 1 file')
ax.scatter(lon8[25:,:],lat8[25:,:],color='MediumVioletRed',marker='o',label='Sequential: Nov 2 file')

ax.legend()
ax.set_title('November 1 - 2')
ax.set_ylabel('Latitude')
ax.set_xlabel('Longitude')

fig.savefig('results_sequential_docs.png')
In [13]: