<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.        ]
{'fraction_non_alphanumeric': 0.1750537634408602, 'fraction_numerical': 0.08623655913978495, 'mean_word_length': 5.809663250366032, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 3, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '85517', 'license': 'Apache-2.0', 'n_tokens_mistral': 2269, 'n_tokens_neox': 2056, 'n_words': 255, 'path': 'Elise/plotResults/ExploringNowcast_GreenOutputs_BioFig-Copy1.ipynb', 'repo_name': 'SalishSeaCast/analysis', 'size': '4650'}