#!/usr/bin/env python # coding: utf-8 # In[1]: import netCDF4 as nc from matplotlib import pyplot as plt import numpy as np import glob import pickle from salishsea_tools import evaltools as et import datetime as dt import os import re import cmocean get_ipython().run_line_magic('matplotlib', 'inline') # In[2]: with nc.Dataset('/ocean/eolson/MEOPAR/NEMO-forcing/grid/mesh_mask201702_noLPE.nc') as mesh: tmask=mesh.variables['tmask'][0,:,:,:] e1t=np.expand_dims(mesh.variables['e1t'][:,:,:],1) e2t=np.expand_dims(mesh.variables['e2t'][:,:,:],1) SOGtmaskPath='/ocean/eolson/MEOPAR/northernNO3PaperCalcs/save/SOGtmask.pkl' (tmaskSOG,_,_,_,_)=pickle.load(open(SOGtmaskPath,'rb')) # In[3]: idir='/data/eolson/results/MEOPAR/SS36runs/CedarRuns/shortTestTRD/' # In[4]: fP=nc.Dataset(glob.glob(idir+'/SalishSea_1d_*_dian_T*.nc')[0]) # In[5]: fP.variables.keys() # In[6]: fP.variables['REM_DON'] # In[7]: np.max(np.ma.masked_where(tmask==0,fP.variables['SMS_NO3'][0,:,:,:])),np.min(np.ma.masked_where(tmask==0,fP.variables['SMS_NO3'][0,:,:,:])) # In[8]: np.max(np.ma.masked_where(tmask==0,fP.variables['ATF_NO3'][0,:,:,:])),np.min(np.ma.masked_where(tmask==0,fP.variables['ATF_NO3'][0,:,:,:])) np.max(np.ma.masked_where(tmask[0,:,:]==0,fP.variables['ATF_NO3'][0,0,:,:]/fP.variables['AFILTNO3'][0,0,:,:])),np.min(np.ma.masked_where(tmask[0,:,:]==0,fP.variables['ATF_NO3'][0,0,:,:]/fP.variables['AFILTNO3'][0,0,:,:])) # In[9]: np.max(np.ma.masked_where(tmask==0,fP.variables['RDB_NO3'][0,:,:,:])),np.min(np.ma.masked_where(tmask==0,fP.variables['RDB_NO3'][0,:,:,:])) # In[10]: np.max(np.ma.masked_where(tmask==0,fP.variables['RDN_NO3'][0,:,:,:])),np.min(np.ma.masked_where(tmask==0,fP.variables['RDN_NO3'][0,:,:,:])) # In[11]: np.max(np.ma.masked_where(tmask==0,fP.variables['NO3RAD'][0,:,:,:])),np.min(np.ma.masked_where(tmask==0,fP.variables['NO3RAD'][0,:,:,:])) # In[12]: np.max(np.ma.masked_where(tmask==0,fP.variables['REM_DON'][0,:,:,:])),np.min(np.ma.masked_where(tmask==0,fP.variables['REM_DON'][0,:,:,:])) # In[13]: np.max(np.ma.masked_where(tmask==0,fP.variables['REM_bSi'][0,:,:,:])),np.min(np.ma.masked_where(tmask==0,fP.variables['REM_bSi'][0,:,:,:])) # In[14]: np.max(np.ma.masked_where(tmask==0,fP.variables['REM_PON'][0,:,:,:])),np.min(np.ma.masked_where(tmask==0,fP.variables['REM_PON'][0,:,:,:])) # In[15]: np.max(np.ma.masked_where(tmask==0,fP.variables['SMS_NO3'][0,:,:,:])),np.min(np.ma.masked_where(tmask==0,fP.variables['SMS_NO3'][0,:,:,:])) # In[16]: np.max(fP.variables['NITR'][0,0,:,:]-fP.variables['REM_NO3'][0,0,:,:]),np.min(fP.variables['NITR'][0,0,:,:]-fP.variables['REM_NO3'][0,0,:,:]) # In[17]: fig,ax=plt.subplots(1,3,figsize=(8,3)) m0=ax[0].pcolormesh(fP.variables['NITR'][0,0,:,:]) plt.colorbar(m0,ax=ax[0]) m1=ax[1].pcolormesh(fP.variables['REM_NO3'][0,0,:,:]) plt.colorbar(m1,ax=ax[1]) m2=ax[2].pcolormesh(fP.variables['NITR'][0,0,:,:]-fP.variables['REM_NO3'][0,0,:,:],cmap=cmocean.cm.balance) plt.colorbar(m2,ax=ax[2]) fig,ax=plt.subplots(1,3,figsize=(8,3)) m0=ax[0].pcolormesh(fP.variables['BIOTRNO3'][0,0,:,:]) plt.colorbar(m0,ax=ax[0]) m1=ax[1].pcolormesh(fP.variables['SMS_NO3'][0,0,:,:]) plt.colorbar(m1,ax=ax[1]) m2=ax[2].pcolormesh(fP.variables['BIOTRNO3'][0,0,:,:]-fP.variables['SMS_NO3'][0,0,:,:],cmap=cmocean.cm.balance) plt.colorbar(m2,ax=ax[2]) # In[ ]: # In[ ]: # In[6]: fS=nc.Dataset(glob.glob(idir+'/SalishSea_1d_*_Sutil_V*.nc')[0]) fS.variables.keys() # In[18]: fS=nc.Dataset(glob.glob(idir+'/SalishSea_1d_*_Sutil_V*.nc')[0]) fS.variables.keys() # In[8]: np.max(fS.variables['LDF_NO3'][0,:,:,:]),np.min(fS.variables['LDF_NO3'][0,:,:,:]) # In[ ]: # In[19]: fS.variables['ATY_NO3'] # In[20]: fig,ax=plt.subplots(1,3,figsize=(8,3)) m0=ax[0].pcolormesh(fS.variables['NO3TVDY'][0,:,0,:]) plt.colorbar(m0,ax=ax[0]) m1=ax[1].pcolormesh(fS.variables['ATY_NO3'][0,:,0,:]) plt.colorbar(m1,ax=ax[1]) m2=ax[2].pcolormesh(fS.variables['NO3TVDY'][0,:,0,:]-fS.variables['ATY_NO3'][0,:,0,:],cmap=cmocean.cm.balance) plt.colorbar(m2,ax=ax[2]) # In[20]: fig,ax=plt.subplots(1,3,figsize=(8,3)) m0=ax[0].pcolormesh(fS.variables['NO3TVDY'][0,:,0,:]) plt.colorbar(m0,ax=ax[0]) m1=ax[1].pcolormesh(fS.variables['ATY_NO3'][0,:,0,:]) plt.colorbar(m1,ax=ax[1]) m2=ax[2].pcolormesh(fS.variables['NO3TVDY'][0,:,0,:]-fS.variables['ATY_NO3'][0,:,0,:],cmap=cmocean.cm.balance) plt.colorbar(m2,ax=ax[2]) # In[ ]: