Notebook to quickly examine one simulation
import netCDF4 as nc
from salishsea_tools import nc_tools
import matplotlib.pyplot as plt
import numpy as np
import os
%matplotlib inline
results = '/data/nsoontie/MEOPAR/SalishSea/results/2Ddomain/3.6/'
run = 'timestep_check/diff1e-6_river'
path = os.path.join(results,run)
print(path)
filepart = 'output.abort_0000.nc'
/data/nsoontie/MEOPAR/SalishSea/results/2Ddomain/3.6/timestep_check/diff1e-6_river
y = 3
f = nc.Dataset(os.path.join(path,filepart))
Us = f.variables['vozocrtx'][:,:,y,:]
Ws = f.variables['vovecrtz'][:,:,y,:]
Ts = f.variables['votemper'][:,:,y,:]
Ss = f.variables['vosaline'][:,:,y,:]
ssh = f.variables['sossheig'][:,y,:]
depths = f.variables['deptht'][:]
x = f.variables['nav_lon'][y,:]
xx,zz = np.meshgrid(x,-depths[:])
fig, ax = plt.subplots(1,1,figsize=(15,4))
t=0
mesh=ax.pcolormesh(xx,zz,Ss[t,:,:])
ax.set_title('Sal: t={} : {}'.format(t, run))
fig.colorbar(mesh,ax=ax)
ax.set_xlim([500,650])
ax.set_ylim([-50,0])
(-50, 0)
fig, ax = plt.subplots(1,1,figsize=(15,4))
t=0
mesh=ax.pcolormesh(xx,zz,Ts[t,:,:])
ax.set_title('Temp: t={} : {}'.format(t, run))
fig.colorbar(mesh,ax=ax)
ax.set_xlim([500,650])
ax.set_ylim([-50,0])
(-50, 0)
fig, ax = plt.subplots(1,1,figsize=(15,4))
t=0
mesh=ax.pcolormesh(xx,zz,Us[t,:,:])
ax.set_title('U: t={} : {}'.format(t, run))
fig.colorbar(mesh,ax=ax)
ax.set_xlim([500,650])
ax.set_ylim([-50,0])
(-50, 0)
fig, ax = plt.subplots(1,1,figsize=(15,4))
t=0
mesh=ax.pcolormesh(xx,zz,Ws[t,:,:])
ax.set_title('W: t={} : {}'.format(t, run))
fig.colorbar(mesh,ax=ax)
ax.set_xlim([500,650])
ax.set_ylim([-50,0])
(-50, 0)
fig, ax = plt.subplots(1,1,figsize=(15,4))
t=0
ax.plot(ssh[t,:])
ax.set_title('ssh: t={} : {}'.format(t, run))
#ax.set_xlim([500,650])
#ax.set_ylim([-50,0])
<matplotlib.text.Text at 0x7f311ff188d0>
#