#!/usr/bin/env python
# coding: utf-8
#
Table of Contents
#
# Crashing on first time step on the western boundary at 2 465 14 in fortran.
# Going to try smoothing the restart file.
# In[1]:
import matplotlib.pyplot as plt
import numpy as np
import xarray as xr
get_ipython().run_line_magic('matplotlib', 'inline')
# In[2]:
restart_file = xr.open_dataset('/results/SalishSea/nowcast-agrif.201702/13nov20/SalishSea_04914000_restart.nc')
restart_file
# In[7]:
prob = 465-1
pz = 14-1
# Look at velocity
# In[8]:
ib, ie = 385, 467
uveln19 = restart_file.un[0, pz]
uvelb19 = restart_file.ub[0, pz]
uvelb19[ib:ie, 1].plot(label="Before 1", linewidth=5)
uveln19[ib:ie, 1].plot(label="Next 1")
uvelb19[ib:ie, 3].plot(label="Before 3", linewidth=5)
uveln19[ib:ie, 3].plot(label="Next 3")
plt.plot([prob-ib, prob-ib], [-0.5, 2], color='k');
plt.legend();
# In[9]:
ib, ie = 385, 467
vveln19 = restart_file.vn[0, pz]
vvelb19 = restart_file.vb[0, pz]
vvelb19[ib:ie, 1].plot(label="Before 1", linewidth=5)
vveln19[ib:ie, 1].plot(label="Next 1")
vvelb19[ib:ie, 3].plot(label="Before 3", linewidth=5)
vveln19[ib:ie, 3].plot(label="Next 3")
plt.plot([prob-ib, prob-ib], [-0.5, 2], color='k');
plt.legend();
# In[10]:
restart_file.un[0, :, :, 1] = restart_file.un[0, :, :, 2]
restart_file.ub[0, :, :, 1] = restart_file.ub[0, :, :, 2]
restart_file.vn[0, :, :, 1] = restart_file.vn[0, :, :, 2]
restart_file.vb[0, :, :, 1] = restart_file.vb[0, :, :, 2]
# In[11]:
restart_file.attrs['Modified'] = 'copied velocity one away from west boundary to boundary'
restart_file.attrs
# In[12]:
restart_file.to_netcdf('SalishSea_04914000_restart.nc')
# In[ ]: