import xarray as xr
import matplotlib.pyplot as plt
%matplotlib inline
from salishsea_tools import viz_tools
import matplotlib.patches as patches
grid = xr.open_dataset('/data/vdo/MEOPAR/NEMO-forcing/grid/bathymetry_201702.nc')
grid.isel(x=112,y=560+130)
<xarray.Dataset> Dimensions: () Data variables: nav_lon float64 -125.1 nav_lat float64 49.79 Bathymetry float64 nan Attributes: Conventions: CF-1.6 title: Bathymetry 201702 institution: Dept of Earth, Ocean & Atmospheric Sciences, University of ... source: https://bitbucket.org/salishsea/tools/src/tip/ProcessNewRiv... references: NEMO-forcing/grid/bathymetry_201702.nc history: [2017-04-12 16:27:28] Created netCDF4 zlib=True dataset. comment: Bathymetry processed from Michaels New Full River Bathymetry
fig,ax = plt.subplots(1,1,figsize=(20,16))
grid.Bathymetry.plot()
viz_tools.set_aspect(ax)
ax.add_patch(patches.Rectangle(
(177,225),195,178,fill=False, linewidth = 3)) #HS1
ax.add_patch(patches.Rectangle(
(112,592), 30, 65, fill=False, linewidth = 3)) #BS1
ax.add_patch(patches.Rectangle((112,560), 45, 130, fill=False, linewidth=3)) #BS2
plt.savefig('AGRIF_subdomains.png', bbox_inches='tight')
fig,ax = plt.subplots(1,1,figsize=(20,16))
grid.Bathymetry.plot()
viz_tools.set_aspect(ax)
#ax.plot(155,558,'r*', markersize=20)
ax.plot(125,599, 'r*', markersize=25)
#plt.grid('on')
plt.savefig('HairballsLocation', bbox_inches='tight')
fig,ax = plt.subplots(1,1,figsize=(20,16))
grid.Bathymetry.plot()
viz_tools.set_aspect(ax)
plt.grid('on')
plt.xlim(120,250)
plt.ylim(500,600)
plt.plot(155,558,'r*', markersize=25)
[<matplotlib.lines.Line2D at 0x7f2709937b00>]