<jupyter_start><jupyter_text>This notebook will be used to look at plots from the nowcast_green runs<jupyter_code>import matplotlib.pyplot as plt
import netCDF4 as nc
import numpy as np
import glob

from salishsea_tools import viz_tools

#from nowcast import analyze

%matplotlib inline<jupyter_output><empty_output><jupyter_text>Loading nowcast_green results<jupyter_code>dmy = '21feb16'
dateStr = 'Feb 21, 2016'
filename = glob.glob('/results/SalishSea/nowcast-green/%s/SalishSea_1h_*_ptrc_T.nc' % dmy)
grid_g = nc.Dataset(filename[0])
thalweg = np.loadtxt('/data/dlatorne/MEOPAR/tools/bathymetry/thalweg_working.txt', dtype=int, unpack=True)
bio = nc.Dataset('/data/eolson/MEOPAR/SS36runs/run_full_01/mesh_mask.nc')
e3t = bio.variables['e3t_0']

fm=nc.Dataset('/data/eolson/MEOPAR/SS36runs/run_full_01/mesh_mask.nc')
mesh0=fm.variables['tmask'][:,:,:,:]<jupyter_output><empty_output><jupyter_text>Pre-load and set some variable<jupyter_code>zlevels = grid_g.variables['deptht'][:]
x, z = np.meshgrid(np.arange(thalweg.shape[1]), zlevels)
time = -1<jupyter_output><empty_output><jupyter_text>Make Depth integrated plots for creatures...<jupyter_code>fig, axs = plt.subplots(1,1,figsize=(5,4))
    
conc = grid_g.variables['PHY2']
conc_ma = np.ma.masked_where(mesh0[time,:,:,:]==0,conc[time,:,:,:])
    
dep_int = conc_ma*e3t[0,:,:,:]
dep_int_sum = np.sum(dep_int, axis=0)

cmap = plt.get_cmap('Greens')
cmap.set_bad('burlywood')
    
#Surface plot
mesh = axs.pcolormesh(dep_int_sum, cmap=cmap)
cbar = fig.colorbar(mesh)
cbar.ax.tick_params(labelsize=18)
axs.set_title('Diatoms (mmol N/m$^2$)\n 21 Feb 2016'.format(label=conc.long_name.title()), fontsize=18)
#cbar.set_label('{label} [{units}]'.format(label=conc.long_name.title(), units=conc.units))
axs.get_xaxis().set_visible(False)
axs.get_yaxis().set_visible(False)
fig.savefig('DIA_feb21.png',dpi=200)
fig, axs = plt.subplots(1,1,figsize=(5,4))
    
conc = grid_g.variables['PHY']
conc_ma = np.ma.masked_where(mesh0[time,:,:,:]==0,conc[time,:,:,:])
    
dep_int = conc_ma*e3t[0,:,:,:]
dep_int_sum1 = np.sum(dep_int, axis=0)

cmap = plt.get_cmap('Greens')
cmap.set_bad('burlywood')
    
#Surface plot
mesh = axs.pcolormesh(dep_int_sum1, cmap=cmap)
cbar = fig.colorbar(mesh)
cbar.ax.tick_params(labelsize=18)
axs.set_title('Cryptophytes\n (mmol N/m$^2$) 21 Feb 2016'.format(label=conc.long_name.title()), fontsize=18)
#cbar.set_label('{label} [{units}]'.format(label=conc.long_name.title(), units=conc.units))
axs.get_xaxis().set_visible(False)
axs.get_yaxis().set_visible(False)
fig.savefig('CRY_feb21.png',dpi=200)
mesh=plt.pcolormesh(dep_int_sum-dep_int_sum1)
fig, axs = plt.subplots(1,1,figsize=(4,4))

#Prepare surface values
conc=grid_g.variables['PHY2']
conc_ma = np.ma.masked_where(mesh0[time,5,:,:]==0,conc[time,5,:,:])
vmin = np.min(conc_ma)
vmax = np.max(conc_ma)

cmap = plt.get_cmap('Greens')
cmap.set_bad('burlywood')
    
#Surface plot
mesh = axs.pcolormesh(conc_ma, cmap=cmap,vmin=vmin,vmax=vmax)
cbar = fig.colorbar(mesh)
cbar.ax.tick_params(labelsize=18)
axs.set_title('Diatoms ($\mu$molN/L)'.format(label=conc.long_name.title()), fontsize=18)
#cbar.set_label('{label} [{units}]'.format(label=conc.long_name.title(), units=conc.units))
axs.get_xaxis().set_visible(False)
axs.get_yaxis().set_visible(False)
fig.savefig('/home/eolson/pyCode/notebooks/figs/diat5_feb21.png')
fig, axs = plt.subplots(1,1,figsize=(4,4))

#Prepare surface values
conc=grid_g.variables['PHY']
conc_ma = np.ma.masked_where(mesh0[time,5,:,:]==0,conc[time,5,:,:])
vmin = np.min(conc_ma)
vmax = np.max(conc_ma)

cmap = plt.get_cmap('Greens')
cmap.set_bad('burlywood')
    
#Surface plot
mesh = axs.pcolormesh(conc_ma, cmap=cmap,vmin=vmin,vmax=vmax)
cbar = fig.colorbar(mesh)
cbar.ax.tick_params(labelsize=18)
axs.set_title('Cryptophytes ($\mu$molN/L)'.format(label=conc.long_name.title()), fontsize=18)
#cbar.set_label('{label} [{units}]'.format(label=conc.long_name.title(), units=conc.units))
axs.get_xaxis().set_visible(False)
axs.get_yaxis().set_visible(False)
fig.savefig('/home/eolson/pyCode/notebooks/figs/cryp5_feb21.png')
np.max(dep_int_sum-dep_int_sum1)
print(e3t[0,:,80,80])
print(conc[0,:,400,278])<jupyter_output>[ 0.62146878  0.53342253  0.55406117  0.56883675  0.57384235  0.54649651
  0.46599182  0.44477132  0.40151158  0.37077749  0.33410913  0.30188334
  0.26949489  0.23926082  0.21087879  0.18470751  0.16092458  0.13908485
  0.1189063   0.0996279   0.08169907  0.06432903  0.050627    0.03780834
  0.02589374  0.01553052  0.0128355   0.00899197  0.00512414  0.00410862
  0.          0.          0.          0.          0.          0.          0.
  0.          0.          0.        ]