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/nowcast-green/08mar15/SalishSea_2h_20150308_20150317_dia1_T.nc')
fmar2=nc.Dataset('/results/SalishSea/nowcast-green/08mar15/SalishSea_1d_20150308_20150308_dia2_T.nc')
j,i=places.PLACES['S3']['NEMO grid ji']
fmar1.variables.keys()
odict_keys(['HetMRub', 'MORTDIAT', 'MORTMRUB', 'MORTPHY', 'PAR', 'PPDIAT', 'PPDIATNO3', 'PPMRUB', 'PPMRUBNO3', 'PPPHY', 'PPPHYNO3', 'TQ10', 'area', 'bounds_lat', 'bounds_lon', 'deptht', 'deptht_bounds', 'nav_lat', 'nav_lon', 'time_centered', 'time_centered_bounds', 'time_counter', 'time_counter_bounds'])
fmar2.variables.keys()
odict_keys(['GRMESZDIAT', 'GRMESZMICZ', 'GRMESZMRUB', 'GRMESZPHY', 'GRMESZPON', 'GRMICZDIAT', 'GRMICZMICZ', 'GRMICZMRUB', 'GRMICZPHY', 'GRMICZPON', 'area', 'bounds_lat', 'bounds_lon', 'deptht', 'deptht_bounds', 'nav_lat', 'nav_lon', 'time_centered', 'time_centered_bounds', 'time_counter', 'time_counter_bounds'])
fig,ax=plt.subplots(1,1,figsize=(8,8))
ax.set_ylim(100,0)
ax.plot(np.mean(fmar1.variables['MORTDIAT'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'b-',label='mort_diat')
ax.plot(np.mean(fmar1.variables['MORTMRUB'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'m-',label='mort_mrub')
ax.plot(np.mean(fmar1.variables['MORTPHY'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'y-',label='mort_phy')
ax.plot(np.mean(fmar1.variables['HetMRub'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'-',
color='orange',label='mort_phy')
ax.plot(fmar2.variables['GRMESZDIAT'][0,:,j,i],fmar1.variables['deptht'][:],'b--',label='MESZ_diat')
ax.plot(fmar2.variables['GRMESZMRUB'][0,:,j,i],fmar1.variables['deptht'][:],'m--',label='MESZ_mrub')
ax.plot(fmar2.variables['GRMESZPHY'][0,:,j,i],fmar1.variables['deptht'][:],'y--',label='MESZ_diat')
ax.plot(fmar2.variables['GRMICZDIAT'][0,:,j,i],fmar1.variables['deptht'][:],'bx',label='MIC_diat')
ax.plot(fmar2.variables['GRMICZMRUB'][0,:,j,i],fmar1.variables['deptht'][:],'mx',label='MIC_mrub')
ax.plot(fmar2.variables['GRMICZPHY'][0,:,j,i],fmar1.variables['deptht'][:],'yx',label='MIC_diat')
plt.legend(loc=4)
ax.set_title('March 8')
<matplotlib.text.Text at 0x7faf17ebd208>
fjun1=nc.Dataset('/results/SalishSea/nowcast-green/06jun15/SalishSea_2h_20150606_20150615_dia1_T.nc')
fjun2=nc.Dataset('/results/SalishSea/nowcast-green/06jun15/SalishSea_1d_20150606_20150606_dia2_T.nc')
fig,ax=plt.subplots(1,1,figsize=(8,8))
ax.set_ylim(100,0)
ax.plot(np.mean(fjun1.variables['MORTDIAT'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'b-',label='mort_diat')
ax.plot(np.mean(fjun1.variables['MORTMRUB'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'m-',label='mort_mrub')
ax.plot(np.mean(fjun1.variables['MORTPHY'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'y-',label='mort_phy')
ax.plot(np.mean(fjun1.variables['HetMRub'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'-',
color='orange',label='mort_phy')
ax.plot(fjun2.variables['GRMESZDIAT'][0,:,j,i],fmar1.variables['deptht'][:],'b--',label='MESZ_diat')
ax.plot(fjun2.variables['GRMESZMRUB'][0,:,j,i],fmar1.variables['deptht'][:],'m--',label='MESZ_mrub')
ax.plot(fjun2.variables['GRMESZPHY'][0,:,j,i],fmar1.variables['deptht'][:],'y--',label='MESZ_diat')
ax.plot(fjun2.variables['GRMICZDIAT'][0,:,j,i],fmar1.variables['deptht'][:],'bx',label='MIC_diat')
ax.plot(fjun2.variables['GRMICZMRUB'][0,:,j,i],fmar1.variables['deptht'][:],'mx',label='MIC_mrub')
ax.plot(fjun2.variables['GRMICZPHY'][0,:,j,i],fmar1.variables['deptht'][:],'yx',label='MIC_diat')
plt.legend(loc=4)
ax.set_title('June 6')
<matplotlib.text.Text at 0x7faf17d6e470>
faug1=nc.Dataset('/results/SalishSea/nowcast-green/05aug15/SalishSea_2h_20150805_20150814_dia1_T.nc')
faug2=nc.Dataset('/results/SalishSea/nowcast-green/05aug15/SalishSea_1d_20150805_20150805_dia2_T.nc')
fig,ax=plt.subplots(1,1,figsize=(8,8))
ax.set_ylim(100,0)
ax.plot(np.mean(faug1.variables['MORTDIAT'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'b-',label='mort_diat')
ax.plot(np.mean(faug1.variables['MORTMRUB'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'m-',label='mort_mrub')
ax.plot(np.mean(faug1.variables['MORTPHY'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'y-',label='mort_phy')
ax.plot(np.mean(faug1.variables['HetMRub'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'-',
color='orange',label='mort_phy')
ax.plot(faug2.variables['GRMESZDIAT'][0,:,j,i],fmar1.variables['deptht'][:],'b--',label='MESZ_diat')
ax.plot(faug2.variables['GRMESZMRUB'][0,:,j,i],fmar1.variables['deptht'][:],'m--',label='MESZ_mrub')
ax.plot(faug2.variables['GRMESZPHY'][0,:,j,i],fmar1.variables['deptht'][:],'y--',label='MESZ_diat')
ax.plot(faug2.variables['GRMICZDIAT'][0,:,j,i],fmar1.variables['deptht'][:],'bx',label='MIC_diat')
ax.plot(faug2.variables['GRMICZMRUB'][0,:,j,i],fmar1.variables['deptht'][:],'mx',label='MIC_mrub')
ax.plot(faug2.variables['GRMICZPHY'][0,:,j,i],fmar1.variables['deptht'][:],'yx',label='MIC_diat')
plt.legend(loc=4)
ax.set_title('Aug 5')
<matplotlib.text.Text at 0x7faf17c64550>
foct1=nc.Dataset('/results/SalishSea/nowcast-green/14oct15/SalishSea_2h_20151014_20151023_dia1_T.nc')
foct2=nc.Dataset('/results/SalishSea/nowcast-green/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(np.mean(f1.variables['MORTDIAT'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'b-',label='mort_diat')
ax.plot(np.mean(f1.variables['MORTMRUB'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'m-',label='mort_mrub')
ax.plot(np.mean(f1.variables['MORTPHY'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'y-',label='mort_phy')
ax.plot(np.mean(f1.variables['HetMRub'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'-',
color='orange',label='mort_phy')
ax.plot(f2.variables['GRMESZDIAT'][0,:,j,i],fmar1.variables['deptht'][:],'b--',label='MESZ_diat')
ax.plot(f2.variables['GRMESZMRUB'][0,:,j,i],fmar1.variables['deptht'][:],'m--',label='MESZ_mrub')
ax.plot(f2.variables['GRMESZPHY'][0,:,j,i],fmar1.variables['deptht'][:],'y--',label='MESZ_diat')
ax.plot(f2.variables['GRMICZDIAT'][0,:,j,i],fmar1.variables['deptht'][:],'bx',label='MIC_diat')
ax.plot(f2.variables['GRMICZMRUB'][0,:,j,i],fmar1.variables['deptht'][:],'mx',label='MIC_mrub')
ax.plot(f2.variables['GRMICZPHY'][0,:,j,i],fmar1.variables['deptht'][:],'yx',label='MIC_diat')
plt.legend(loc=4)
ax.set_title('Oct 14')
<matplotlib.text.Text at 0x7faf17bfbcf8>
fig,axs=plt.subplots(4,1,figsize=(16,12))
ax=axs[0]
ax.set_ylim(40,0)
f1=fmar1
f2=fmar2
ax.plot(np.mean(f1.variables['MORTDIAT'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'b-',label='mort_diat')
ax.plot(np.mean(f1.variables['MORTMRUB'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'m-',label='mort_mrub')
ax.plot(np.mean(f1.variables['MORTPHY'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'y-',label='mort_phy')
ax.plot(np.mean(f1.variables['HetMRub'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'-',
color='orange',label='mort_phy')
ax.plot(f2.variables['GRMESZDIAT'][0,:,j,i],fmar1.variables['deptht'][:],'b--',label='MESZ_diat')
ax.plot(f2.variables['GRMESZMRUB'][0,:,j,i],fmar1.variables['deptht'][:],'m--',label='MESZ_mrub')
ax.plot(f2.variables['GRMESZPHY'][0,:,j,i],fmar1.variables['deptht'][:],'y--',label='MESZ_diat')
ax.plot(f2.variables['GRMICZDIAT'][0,:,j,i],fmar1.variables['deptht'][:],'bx',label='MIC_diat')
ax.plot(f2.variables['GRMICZMRUB'][0,:,j,i],fmar1.variables['deptht'][:],'mx',label='MIC_mrub')
ax.plot(f2.variables['GRMICZPHY'][0,:,j,i],fmar1.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(np.mean(f1.variables['MORTDIAT'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'b-',label='mort_diat')
ax.plot(np.mean(f1.variables['MORTMRUB'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'m-',label='mort_mrub')
ax.plot(np.mean(f1.variables['MORTPHY'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'y-',label='mort_phy')
ax.plot(np.mean(f1.variables['HetMRub'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'-',
color='orange',label='mort_phy')
ax.plot(f2.variables['GRMESZDIAT'][0,:,j,i],fmar1.variables['deptht'][:],'b--',label='MESZ_diat')
ax.plot(f2.variables['GRMESZMRUB'][0,:,j,i],fmar1.variables['deptht'][:],'m--',label='MESZ_mrub')
ax.plot(f2.variables['GRMESZPHY'][0,:,j,i],fmar1.variables['deptht'][:],'y--',label='MESZ_diat')
ax.plot(f2.variables['GRMICZDIAT'][0,:,j,i],fmar1.variables['deptht'][:],'bx',label='MIC_diat')
ax.plot(f2.variables['GRMICZMRUB'][0,:,j,i],fmar1.variables['deptht'][:],'mx',label='MIC_mrub')
ax.plot(f2.variables['GRMICZPHY'][0,:,j,i],fmar1.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(np.mean(f1.variables['MORTDIAT'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'b-',label='mort_diat')
ax.plot(np.mean(f1.variables['MORTMRUB'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'m-',label='mort_mrub')
ax.plot(np.mean(f1.variables['MORTPHY'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'y-',label='mort_phy')
ax.plot(np.mean(f1.variables['HetMRub'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'-',
color='orange',label='mort_phy')
ax.plot(f2.variables['GRMESZDIAT'][0,:,j,i],fmar1.variables['deptht'][:],'b--',label='MESZ_diat')
ax.plot(f2.variables['GRMESZMRUB'][0,:,j,i],fmar1.variables['deptht'][:],'m--',label='MESZ_mrub')
ax.plot(f2.variables['GRMESZPHY'][0,:,j,i],fmar1.variables['deptht'][:],'y--',label='MESZ_diat')
ax.plot(f2.variables['GRMICZDIAT'][0,:,j,i],fmar1.variables['deptht'][:],'bx',label='MIC_diat')
ax.plot(f2.variables['GRMICZMRUB'][0,:,j,i],fmar1.variables['deptht'][:],'mx',label='MIC_mrub')
ax.plot(f2.variables['GRMICZPHY'][0,:,j,i],fmar1.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(np.mean(f1.variables['MORTDIAT'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'b-',label='mort_diat')
ax.plot(np.mean(f1.variables['MORTMRUB'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'m-',label='mort_mrub')
ax.plot(np.mean(f1.variables['MORTPHY'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'y-',label='mort_phy')
ax.plot(np.mean(f1.variables['HetMRub'][0:24,:,j,i],0)/40,fmar1.variables['deptht'][:],'-',
color='orange',label='mort_phy')
ax.plot(f2.variables['GRMESZDIAT'][0,:,j,i],fmar1.variables['deptht'][:],'b--',label='MESZ_diat')
ax.plot(f2.variables['GRMESZMRUB'][0,:,j,i],fmar1.variables['deptht'][:],'m--',label='MESZ_mrub')
ax.plot(f2.variables['GRMESZPHY'][0,:,j,i],fmar1.variables['deptht'][:],'y--',label='MESZ_diat')
ax.plot(f2.variables['GRMICZDIAT'][0,:,j,i],fmar1.variables['deptht'][:],'bx',label='MIC_diat')
ax.plot(f2.variables['GRMICZMRUB'][0,:,j,i],fmar1.variables['deptht'][:],'mx',label='MIC_mrub')
ax.plot(f2.variables['GRMICZPHY'][0,:,j,i],fmar1.variables['deptht'][:],'yx',label='MIC_diat')
ax.set_xlim(0,2e-5)
ax.set_title('Oct')
<matplotlib.text.Text at 0x7faf155d30b8>