%matplotlib inline from matplotlib import pylab import matplotlib.pyplot as plt import netCDF4 as NC import numpy as np from mpl_toolkits.mplot3d import Axes3D from salishsea_tools import (nc_tools,viz_tools) f= NC.Dataset('/ocean/nsoontie/MEOPAR/Ariane/examples/qualitative/ariane_trajectories_qualitative.nc','r'); nc_tools.show_variables(f) nc_tools.show_dimensions(f) lon=f.variables['traj_lon'] lat=f.variables['traj_lat'] dep=f.variables['traj_depth'] print lon fig = plt.figure(figsize=(20,10)) ax = fig.gca(projection='3d') colors=['b','g','r'] for i in range(3): ax.scatter(lon[:,i],lat[:,i],dep[:,i],c=colors[i]) ax.set_xlabel('lon') ax.set_ylabel('lat') ax.set_zlabel('depth') #Ariane f= NC.Dataset('/ocean/nsoontie/MEOPAR/Ariane/results/dec2006/1hour/ariane_trajectories_qualitative.nc','r'); lont=f.variables['traj_lon'] latt=f.variables['traj_lat'] dept=f.variables['traj_depth'] xs=f.variables['init_x'] ys=f.variables['init_y'] #Bathymetry fB = NC.Dataset('/data/nsoontie/MEOPAR/NEMO-forcing/grid/bathy_meter_SalishSea2.nc','r') lats = fB.variables['nav_lat'] lons = fB.variables['nav_lon'] D = fB.variables['Bathymetry'] print ys[0] fig, ax = plt.subplots(1,1,figsize=(5,8)) ax.scatter(lont[:,0],latt[:,0],c='r') ax.plot(lons[int(ys[0]),int(xs[0])],lats[int(ys[0]),int(xs[0])], 's') viz_tools.plot_land_mask(ax,fB,coords='map') ax.set_xlabel('lon') ax.set_ylabel('lat') ax.set_xlim([-123.8,-122.8]) ax.set_ylim([48.8,49.5])