import numpy as np
import matplotlib.pyplot as plt
import netCDF4 as nc
%matplotlib inline
fbathy=nc.Dataset('/data/eolson/results/MEOPAR/NEMO-forcing-new/grid/bathymetry_201702.nc')
fphy=nc.Dataset('/results/SalishSea/nowcast-green.201812/01jun16/SalishSea_1d_20160601_20160601_ptrc_T.nc')
fbathy.variables.keys()
dict_keys(['nav_lon', 'nav_lat', 'Bathymetry'])
fphy.variables.keys()
dict_keys(['nav_lat', 'nav_lon', 'bounds_lon', 'bounds_lat', 'area', 'deptht', 'deptht_bounds', 'nitrate', 'time_centered', 'time_centered_bounds', 'time_counter', 'time_counter_bounds', 'ammonium', 'silicon', 'diatoms', 'flagellates', 'ciliates', 'microzooplankton', 'dissolved_organic_nitrogen', 'particulate_organic_nitrogen', 'biogenic_silicon', 'Fraser_tracer', 'mesozooplankton'])
fbathy.variables['Bathymetry']
<class 'netCDF4._netCDF4.Variable'> float64 Bathymetry(y, x) _FillValue: 0.0 least_significant_digit: 0.1 units: metres long_name: sea_floor_depth unlimited dimensions: current shape = (898, 398) filling on
fig,ax=plt.subplots(1,1,figsize=(5,10))
ax.pcolormesh(fphy.variables['mesozooplankton'][0,0,:,:])
ax.contour(fbathy.variables['Bathymetry'][:,:],[100,],colors='w',linewidths=1)
<matplotlib.contour.QuadContourSet at 0x7f0280092520>
fig,ax=plt.subplots(1,1,figsize=(5,10))
ax.contourf(fphy.variables['mesozooplankton'][0,0,:,:],20)
ax.contour(fbathy.variables['Bathymetry'][:,:],[100,],colors='w',linewidths=1)
<matplotlib.contour.QuadContourSet at 0x7f027ff88550>
fbathy.close()
fphy.close()