#!/usr/bin/env python # coding: utf-8 # In[1]: import numpy as np import netCDF4 as nc import matplotlib.pyplot as plt from salishsea_tools import viz_tools, places get_ipython().run_line_magic('matplotlib', 'inline') # In[2]: #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') # In[3]: j,i=places.PLACES['S3']['NEMO grid ji'] # In[4]: #fmar1.variables.keys() # In[5]: fmar2.variables.keys() # In[6]: 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') # In[7]: #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') # In[8]: 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') # In[9]: #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') # In[10]: 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') # In[11]: #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') # In[12]: 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') # In[13]: 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') # In[ ]: