import numpy as np
import netCDF4 as nc
import matplotlib.pyplot as plt
from salishsea_tools import viz_tools, places
%matplotlib inline
#fmar1=nc.Dataset('/results/SalishSea/hindcast_v1/08mar15/SalishSea_2h_20150301_20150331_dia1_T.nc')
fmar2=nc.Dataset('/results/SalishSea/hindcast_v1/08mar15/SalishSea_1d_20150308_20150308_dia2_T.nc')
j,i=places.PLACES['S3']['NEMO grid ji']
#fmar1.variables.keys()
fmar2.variables.keys()
odict_keys(['nav_lat', 'nav_lon', 'bounds_lon', 'bounds_lat', 'area', 'deptht', 'deptht_bounds', 'HetMRub', 'time_centered', 'time_centered_bounds', 'time_counter', 'time_counter_bounds', 'MORTPHY', 'MORTMRUB', 'MORTDIAT', 'GRMESZDIAT', 'GRMESZMRUB', 'GRMESZPHY', 'GRMESZPON', 'GRMESZMICZ', 'GRMICZDIAT', 'GRMICZMRUB', 'GRMICZPHY', 'GRMICZPON', 'GRMICZMICZ'])
fig,ax=plt.subplots(1,1,figsize=(8,8))
ax.set_ylim(100,0)
ax.plot(fmar2.variables['MORTDIAT'][0,:,j,i]/40,fmar2.variables['deptht'][:],'b-',label='mort_diat')
ax.plot(fmar2.variables['MORTMRUB'][0,:,j,i]/40,fmar2.variables['deptht'][:],'m-',label='mort_mrub')
ax.plot(fmar2.variables['MORTPHY'][0,:,j,i]/40,fmar2.variables['deptht'][:],'y-',label='mort_phy')
ax.plot(fmar2.variables['HetMRub'][0,:,j,i]/40,fmar2.variables['deptht'][:],'-',
color='orange',label='mort_phy')
ax.plot(fmar2.variables['GRMESZDIAT'][0,:,j,i],fmar2.variables['deptht'][:],'b--',label='MESZ_diat')
ax.plot(fmar2.variables['GRMESZMRUB'][0,:,j,i],fmar2.variables['deptht'][:],'m--',label='MESZ_mrub')
ax.plot(fmar2.variables['GRMESZPHY'][0,:,j,i],fmar2.variables['deptht'][:],'y--',label='MESZ_diat')
ax.plot(fmar2.variables['GRMICZDIAT'][0,:,j,i],fmar2.variables['deptht'][:],'bx',label='MIC_diat')
ax.plot(fmar2.variables['GRMICZMRUB'][0,:,j,i],fmar2.variables['deptht'][:],'mx',label='MIC_mrub')
ax.plot(fmar2.variables['GRMICZPHY'][0,:,j,i],fmar2.variables['deptht'][:],'yx',label='MIC_diat')
plt.legend(loc=4)
ax.set_title('March 8')
<matplotlib.text.Text at 0x7ff2daaf7710>
#fjun1=nc.Dataset('/results/SalishSea/hindcast_v1/06jun15/SalishSea_2h_20150601_20150630_dia1_T.nc')
fjun2=nc.Dataset('/results/SalishSea/hindcast_v1/06jun15/SalishSea_1d_20150606_20150606_dia2_T.nc')
fig,ax=plt.subplots(1,1,figsize=(8,8))
ax.set_ylim(100,0)
ax.plot(fjun2.variables['MORTDIAT'][0,:,j,i]/40,fmar2.variables['deptht'][:],'b-',label='mort_diat')
ax.plot(fjun2.variables['MORTMRUB'][0,:,j,i]/40,fmar2.variables['deptht'][:],'m-',label='mort_mrub')
ax.plot(fjun2.variables['MORTPHY'][0,:,j,i]/40,fmar2.variables['deptht'][:],'y-',label='mort_phy')
ax.plot(fjun2.variables['HetMRub'][0,:,j,i]/40,fmar2.variables['deptht'][:],'-',
color='orange',label='mort_phy')
ax.plot(fjun2.variables['GRMESZDIAT'][0,:,j,i],fmar2.variables['deptht'][:],'b--',label='MESZ_diat')
ax.plot(fjun2.variables['GRMESZMRUB'][0,:,j,i],fmar2.variables['deptht'][:],'m--',label='MESZ_mrub')
ax.plot(fjun2.variables['GRMESZPHY'][0,:,j,i],fmar2.variables['deptht'][:],'y--',label='MESZ_diat')
ax.plot(fjun2.variables['GRMICZDIAT'][0,:,j,i],fmar2.variables['deptht'][:],'bx',label='MIC_diat')
ax.plot(fjun2.variables['GRMICZMRUB'][0,:,j,i],fmar2.variables['deptht'][:],'mx',label='MIC_mrub')
ax.plot(fjun2.variables['GRMICZPHY'][0,:,j,i],fmar2.variables['deptht'][:],'yx',label='MIC_diat')
plt.legend(loc=4)
ax.set_title('June 6')
<matplotlib.text.Text at 0x7ff2da8cb048>
#faug1=nc.Dataset('/results/SalishSea/hindcast_v1/05aug15/SalishSea_2h_20150805_20150814_dia1_T.nc')
faug2=nc.Dataset('/results/SalishSea/hindcast_v1/05aug15/SalishSea_1d_20150805_20150805_dia2_T.nc')
fig,ax=plt.subplots(1,1,figsize=(8,8))
ax.set_ylim(100,0)
ax.plot(faug2.variables['MORTDIAT'][0,:,j,i]/40,fmar2.variables['deptht'][:],'b-',label='mort_diat')
ax.plot(faug2.variables['MORTMRUB'][0,:,j,i]/40,fmar2.variables['deptht'][:],'m-',label='mort_mrub')
ax.plot(faug2.variables['MORTPHY'][0,:,j,i]/40,fmar2.variables['deptht'][:],'y-',label='mort_phy')
ax.plot(faug2.variables['HetMRub'][0,:,j,i]/40,fmar2.variables['deptht'][:],'-',
color='orange',label='mort_phy')
ax.plot(faug2.variables['GRMESZDIAT'][0,:,j,i],fmar2.variables['deptht'][:],'b--',label='MESZ_diat')
ax.plot(faug2.variables['GRMESZMRUB'][0,:,j,i],fmar2.variables['deptht'][:],'m--',label='MESZ_mrub')
ax.plot(faug2.variables['GRMESZPHY'][0,:,j,i],fmar2.variables['deptht'][:],'y--',label='MESZ_diat')
ax.plot(faug2.variables['GRMICZDIAT'][0,:,j,i],fmar2.variables['deptht'][:],'bx',label='MIC_diat')
ax.plot(faug2.variables['GRMICZMRUB'][0,:,j,i],fmar2.variables['deptht'][:],'mx',label='MIC_mrub')
ax.plot(faug2.variables['GRMICZPHY'][0,:,j,i],fmar2.variables['deptht'][:],'yx',label='MIC_diat')
plt.legend(loc=4)
ax.set_title('Aug 5')
<matplotlib.text.Text at 0x7ff2da7ccd68>
#foct1=nc.Dataset('/results/SalishSea/hindcast_v1/14oct15/SalishSea_2h_20151014_20151023_dia1_T.nc')
foct2=nc.Dataset('/results/SalishSea/hindcast_v1/14aug15/SalishSea_1d_20150814_20150814_dia2_T.nc')
fig,ax=plt.subplots(1,1,figsize=(8,8))
ax.set_ylim(100,0)
#f1=foct1
f2=foct2
ax.plot(f2.variables['MORTDIAT'][0,:,j,i]/40,fmar2.variables['deptht'][:],'b-',label='mort_diat')
ax.plot(f2.variables['MORTMRUB'][0,:,j,i]/40,fmar2.variables['deptht'][:],'m-',label='mort_mrub')
ax.plot(f2.variables['MORTPHY'][0,:,j,i]/40,fmar2.variables['deptht'][:],'y-',label='mort_phy')
ax.plot(f2.variables['HetMRub'][0,:,j,i]/40,fmar2.variables['deptht'][:],'-',
color='orange',label='mort_phy')
ax.plot(f2.variables['GRMESZDIAT'][0,:,j,i],fmar2.variables['deptht'][:],'b--',label='MESZ_diat')
ax.plot(f2.variables['GRMESZMRUB'][0,:,j,i],fmar2.variables['deptht'][:],'m--',label='MESZ_mrub')
ax.plot(f2.variables['GRMESZPHY'][0,:,j,i],fmar2.variables['deptht'][:],'y--',label='MESZ_diat')
ax.plot(f2.variables['GRMICZDIAT'][0,:,j,i],fmar2.variables['deptht'][:],'bx',label='MIC_diat')
ax.plot(f2.variables['GRMICZMRUB'][0,:,j,i],fmar2.variables['deptht'][:],'mx',label='MIC_mrub')
ax.plot(f2.variables['GRMICZPHY'][0,:,j,i],fmar2.variables['deptht'][:],'yx',label='MIC_diat')
plt.legend(loc=4)
ax.set_title('Oct 14')
<matplotlib.text.Text at 0x7ff2da6cbb70>
fig,axs=plt.subplots(4,1,figsize=(16,12))
ax=axs[0]
ax.set_ylim(40,0)
#f1=fmar1
f2=fmar2
ax.plot(f2.variables['MORTDIAT'][0,:,j,i]/40,fmar2.variables['deptht'][:],'b-',label='mort_diat')
ax.plot(f2.variables['MORTMRUB'][0,:,j,i]/40,fmar2.variables['deptht'][:],'m-',label='mort_mrub')
ax.plot(f2.variables['MORTPHY'][0,:,j,i]/40,fmar2.variables['deptht'][:],'y-',label='mort_phy')
ax.plot(f2.variables['HetMRub'][0,:,j,i]/40,fmar2.variables['deptht'][:],'-',
color='orange',label='mort_phy')
ax.plot(f2.variables['GRMESZDIAT'][0,:,j,i],fmar2.variables['deptht'][:],'b--',label='MESZ_diat')
ax.plot(f2.variables['GRMESZMRUB'][0,:,j,i],fmar2.variables['deptht'][:],'m--',label='MESZ_mrub')
ax.plot(f2.variables['GRMESZPHY'][0,:,j,i],fmar2.variables['deptht'][:],'y--',label='MESZ_diat')
ax.plot(f2.variables['GRMICZDIAT'][0,:,j,i],fmar2.variables['deptht'][:],'bx',label='MIC_diat')
ax.plot(f2.variables['GRMICZMRUB'][0,:,j,i],fmar2.variables['deptht'][:],'mx',label='MIC_mrub')
ax.plot(f2.variables['GRMICZPHY'][0,:,j,i],fmar2.variables['deptht'][:],'yx',label='MIC_diat')
ax.set_xlim(0,2e-5)
ax.set_title('Mar')
ax=axs[1]
ax.set_ylim(40,0)
#f1=fjun1
f2=fjun2
ax.plot(f2.variables['MORTDIAT'][0,:,j,i]/40,fmar2.variables['deptht'][:],'b-',label='mort_diat')
ax.plot(f2.variables['MORTMRUB'][0,:,j,i]/40,fmar2.variables['deptht'][:],'m-',label='mort_mrub')
ax.plot(f2.variables['MORTPHY'][0,:,j,i]/40,fmar2.variables['deptht'][:],'y-',label='mort_phy')
ax.plot(f2.variables['HetMRub'][0,:,j,i]/40,fmar2.variables['deptht'][:],'-',
color='orange',label='mort_phy')
ax.plot(f2.variables['GRMESZDIAT'][0,:,j,i],fmar2.variables['deptht'][:],'b--',label='MESZ_diat')
ax.plot(f2.variables['GRMESZMRUB'][0,:,j,i],fmar2.variables['deptht'][:],'m--',label='MESZ_mrub')
ax.plot(f2.variables['GRMESZPHY'][0,:,j,i],fmar2.variables['deptht'][:],'y--',label='MESZ_diat')
ax.plot(f2.variables['GRMICZDIAT'][0,:,j,i],fmar2.variables['deptht'][:],'bx',label='MIC_diat')
ax.plot(f2.variables['GRMICZMRUB'][0,:,j,i],fmar2.variables['deptht'][:],'mx',label='MIC_mrub')
ax.plot(f2.variables['GRMICZPHY'][0,:,j,i],fmar2.variables['deptht'][:],'yx',label='MIC_diat')
ax.set_xlim(0,2e-5)
ax.set_title('Jun')
ax=axs[2]
ax.set_ylim(40,0)
#f1=faug1
f2=faug2
ax.plot(f2.variables['MORTDIAT'][0,:,j,i]/40,fmar2.variables['deptht'][:],'b-',label='mort_diat')
ax.plot(f2.variables['MORTMRUB'][0,:,j,i]/40,fmar2.variables['deptht'][:],'m-',label='mort_mrub')
ax.plot(f2.variables['MORTPHY'][0,:,j,i]/40,fmar2.variables['deptht'][:],'y-',label='mort_phy')
ax.plot(f2.variables['HetMRub'][0,:,j,i]/40,fmar2.variables['deptht'][:],'-',
color='orange',label='mort_phy')
ax.plot(f2.variables['GRMESZDIAT'][0,:,j,i],fmar2.variables['deptht'][:],'b--',label='MESZ_diat')
ax.plot(f2.variables['GRMESZMRUB'][0,:,j,i],fmar2.variables['deptht'][:],'m--',label='MESZ_mrub')
ax.plot(f2.variables['GRMESZPHY'][0,:,j,i],fmar2.variables['deptht'][:],'y--',label='MESZ_diat')
ax.plot(f2.variables['GRMICZDIAT'][0,:,j,i],fmar2.variables['deptht'][:],'bx',label='MIC_diat')
ax.plot(f2.variables['GRMICZMRUB'][0,:,j,i],fmar2.variables['deptht'][:],'mx',label='MIC_mrub')
ax.plot(f2.variables['GRMICZPHY'][0,:,j,i],fmar2.variables['deptht'][:],'yx',label='MIC_diat')
ax.set_xlim(0,2e-5)
ax.set_title('Aug')
ax=axs[3]
ax.set_ylim(40,0)
#f1=foct1
f2=foct2
ax.plot(f2.variables['MORTDIAT'][0,:,j,i]/40,fmar2.variables['deptht'][:],'b-',label='mort_diat')
ax.plot(f2.variables['MORTMRUB'][0,:,j,i]/40,fmar2.variables['deptht'][:],'m-',label='mort_mrub')
ax.plot(f2.variables['MORTPHY'][0,:,j,i]/40,fmar2.variables['deptht'][:],'y-',label='mort_phy')
ax.plot(f2.variables['HetMRub'][0,:,j,i]/40,fmar2.variables['deptht'][:],'-',
color='orange',label='mort_phy')
ax.plot(f2.variables['GRMESZDIAT'][0,:,j,i],fmar2.variables['deptht'][:],'b--',label='MESZ_diat')
ax.plot(f2.variables['GRMESZMRUB'][0,:,j,i],fmar2.variables['deptht'][:],'m--',label='MESZ_mrub')
ax.plot(f2.variables['GRMESZPHY'][0,:,j,i],fmar2.variables['deptht'][:],'y--',label='MESZ_diat')
ax.plot(f2.variables['GRMICZDIAT'][0,:,j,i],fmar2.variables['deptht'][:],'bx',label='MIC_diat')
ax.plot(f2.variables['GRMICZMRUB'][0,:,j,i],fmar2.variables['deptht'][:],'mx',label='MIC_mrub')
ax.plot(f2.variables['GRMICZPHY'][0,:,j,i],fmar2.variables['deptht'][:],'yx',label='MIC_diat')
ax.set_xlim(0,2e-5)
ax.set_title('Oct')
<matplotlib.text.Text at 0x7ff2da432780>