#!/usr/bin/env python # coding: utf-8 # ### Investigate a Restart File # In[4]: get_ipython().run_line_magic('matplotlib', 'inline') import matplotlib.pyplot as plt import netCDF4 as NC import numpy as np from salishsea_tools import viz_tools from salishsea_tools import tidetools from salishsea_tools import nc_tools # In[2]: filename = '/ocean/sallen/allen/research/MEOPAR/myResults/NEMO36_Tides/base_run/E5s/SalishSea_00055981_restart.nc' fT = NC.Dataset(filename,'r') # In[5]: # Check Dimensions nc_tools.show_dimensions(fT) # In[6]: # Check Variables nc_tools.show_variables(fT) # In[31]: sshn = fT.variables['sshn'][0,:] print sshn.shape me = sshn == 0 etan = np.ma.array(sshn,mask=me) # In[38]: imin = 700; imax = 898; jmin = 100; jmax=300 imin = 750; imax = 800; jmin = 100; jmax=150 fig, ax = plt.subplots(1,1,figsize=(10,10)) mesh = ax.pcolormesh(etan[imin:imax,jmin:jmax]) fig.colorbar(mesh) # In[29]: vvel = fT.variables['vb'][0,:] print vvel.shape me = vvel == 0 v = np.ma.array(vvel,mask=me) # In[40]: level = 0; imin = 00; imax = 898; jmin = 0; jmax=398 imin = 750; imax = 800; jmin = 100; jmax=150 fig, ax = plt.subplots(1,1,figsize=(10,10)) mesh = ax.pcolormesh(v[level,imin:imax,jmin:jmax]) fig.colorbar(mesh) print level, v[level].max(), v[level].min() # In[34]: sshb = fT.variables['sshb'][0,:] print sshb.shape me = sshb == 0 etab = np.ma.array(sshb,mask=me) eta = etan - etab # In[37]: imin = 750; imax = 800; jmin = 100; jmax=150 fig, ax = plt.subplots(1,1,figsize=(10,10)) mesh = ax.pcolormesh(eta[imin:imax,jmin:jmax]) fig.colorbar(mesh) # In[ ]: