#!/usr/bin/env python # coding: utf-8 # Notebook to quickly examine one simulation # In[1]: import netCDF4 as nc from salishsea_tools import nc_tools import matplotlib.pyplot as plt import numpy as np import os get_ipython().run_line_magic('matplotlib', 'inline') # In[2]: results = '/data/nsoontie/MEOPAR/SalishSea/results/2Ddomain/3.6/' run = 'mixing_paper/base_aug_noHoll' path = os.path.join(results,run) print(path) filepart = 'SalishSea_1d_20030819_20030927' # In[3]: y=5 f = nc.Dataset(os.path.join(path,'{}_grid_U.nc'.format(filepart))) Us = f.variables['vozocrtx'][:,:,y,:] f = nc.Dataset(os.path.join(path,'{}_grid_W.nc'.format(filepart))) Ws = f.variables['vovecrtz'][:,:,y,:] Viscs = f.variables['vert_eddy_visc'][:,:,y,:] Diffs = f.variables['vert_eddy_diff'][:,:,y,:] f = nc.Dataset(os.path.join(path,'{}_grid_T.nc'.format(filepart))) Ts = f.variables['votemper'][:,:,y,:] Ss = f.variables['vosaline'][:,:,y,:] depths = f.variables['deptht'][:] x = f.variables['nav_lon'][y,:] xx,zz = np.meshgrid(x,-depths[:]) # In[4]: fig, axs = plt.subplots(6,1,figsize=(15,20)) ts = np.arange(6) for t,ax in zip(ts,axs.flat): mesh=ax.pcolormesh(xx,zz,Ss[t,:,:],vmin=20,vmax=34) ax.set_title('Sal: t={} : {}'.format(t, run)) fig.colorbar(mesh,ax=ax) # In[5]: fig, axs = plt.subplots(6,1,figsize=(15,20)) ts = np.arange(0,24,4) for t,ax in zip(ts,axs.flat): mesh=ax.pcolormesh(xx,zz,Ts[t,:,:],vmin=5,vmax=15) ax.set_title('Temp: t={} : {}'.format(t, run)) fig.colorbar(mesh,ax=ax) # In[6]: print(Ts.max()) # In[7]: fig, axs = plt.subplots(6,1,figsize=(15,20)) ts = np.arange(0,24,4) for t,ax in zip(ts,axs.flat): mesh=ax.pcolormesh(xx,zz,Us[t,:,:],vmin=-1,vmax=1) ax.set_title('U: t={} : {}'.format(t, run)) fig.colorbar(mesh,ax=ax) # In[ ]: