import numpy as np
from salishsea_tools import geo_tools, viz_tools
import matplotlib.pyplot as plt
import netCDF4 as nc
%matplotlib inline
fig, ax = plt.subplots(figsize = (6,6))
viz_tools.set_aspect(ax, coords = 'map')
grid = nc.Dataset('/data/vdo/MEOPAR/NEMO-forcing/grid/bathymetry_201702.nc')
viz_tools.plot_coastline(ax, grid, coords = 'map')
ax.set_ylim(48, 50.5)
ax.legend()
ax.set_xlim(-126, -122.5);
ax.plot(-124.7,49.45,'r*')
No handles with labels found to put in legend.
[<matplotlib.lines.Line2D at 0x7f32c159a6a0>]
meshPath='/ocean/eolson/MEOPAR/NEMO-forcing/grid/mesh_mask201702_noLPE.nc'
maskName='tmask'
with nc.Dataset(meshPath) as fmesh:
omask=np.copy(fmesh.variables[maskName])
navlon=np.copy(fmesh.variables['nav_lon'][:,:])
navlat=np.copy(fmesh.variables['nav_lat'][:,:])
e1t=np.copy(fmesh.variables['e1t'][0,:,:])
e2t=np.copy(fmesh.variables['e2t'][0,:,:])
lmask=-1*(omask[0,0,:,:]-1)
j,i=geo_tools.find_closest_model_point(-124.7,49.45,navlon,navlat)
j,i
(594, 130)
j,i=geo_tools.find_closest_model_point(-124.7,49.45,navlon,navlat,land_mask=lmask,checkTol=True)
j,i
(594, 131)
j,i
(594, 131)
j,i=geo_tools.find_closest_model_point(-124.7,49.45,navlon,navlat,land_mask=lmask,checkTol=True)
fig, ax = plt.subplots(figsize = (6,6))
viz_tools.set_aspect(ax, coords = 'map')
grid = nc.Dataset('/data/vdo/MEOPAR/NEMO-forcing/grid/bathymetry_201702.nc')
viz_tools.plot_coastline(ax, grid, coords = 'map')
ax.set_ylim(48, 50.5)
ax.legend()
ax.set_xlim(-126, -122.5);
ax.plot(-124.7,49.4,'r*')
ax.plot(navlon[j,i],navlat[j,i],'co')
No handles with labels found to put in legend.
[<matplotlib.lines.Line2D at 0x7f32c17f5be0>]
navlon[j,i]--125,navlat[j,i]-49.4
.00388*111*1e3
np.max(e1t),np.min(e1t)
np.shape(e1t)
np.max(e2t)
plt.pcolormesh(e1t)