<jupyter_start><jupyter_text>June 26, 2016 in Hindcast 202007F on 83rd time step goes NaN (physics) 84th (biology)<jupyter_code>import xarray as xr
gT = xr.open_dataset('/home/sallen/202007/202007F/SalishSea_1h_20160626_20160630_grid_T_20160626-20160626.nc')
gT.votemper[0, 0].plot();
gU = xr.open_dataset('/home/sallen/202007/202007F/SalishSea_1h_20160626_20160630_grid_U_20160626-20160626.nc')
gU.vozocrtx[0, 0].plot();
gT.vosaline[0, 4, 700:900, 0:250].plot();<jupyter_output><empty_output><jupyter_text>So we have NaN about 100 grid points from the boundary.  That is 100 barotropic grid points or about 5 baroclinic time steps.  We'd expect that on time step 90 we would see 7*20: about 140 grid cells impacts.<jupyter_code>gT.sossheig[0].plot(vmax=1, vmin=-1, cmap='plasma');<jupyter_output><empty_output><jupyter_text>However,We note that the lowR run went unstable on the first time step for 21Jul15 and that the maximum velocity at the first time step here is 15.2 m/s.  Things appear to have calmed down before the instability above, but a smooth restart might easily solve this problem.Note that I originally thought the dates matched but they are 11 months out.  Also lowR is western boundary, this is northern boundary.  So not clear that this is a starting boundary problem.  Rivers<jupyter_code>rivers = xr.open_dataset('/home/sallen/MEOPAR/Tools/I_ForcingFiles/Rivers/ncfiles/R202102Dailies_y2016m06d26.nc')
rivers
rivers.rorunoff.max()
rivers.rorunoff.min()
rivers.rorunoff[0, 800:, 50:150].plot(cmap='gist_ncar_r');
sshb = xr.open_dataset('/results/forcing/sshNeahBay/obs/ssh_y2016m06d25.nc')
ssh = xr.open_dataset('/results/forcing/sshNeahBay/obs/ssh_y2016m06d26.nc')
ssh
ssh.sossheig[:, 0, 40].plot()
sshb.sossheig[:, 0, 40].plot()<jupyter_output><empty_output><jupyter_text>Whatever, smooth the boundary conditions and see if that works (if not add the NaN code)<jupyter_code>import matplotlib.pyplot as plt
import numpy as np

%matplotlib inline
restart_file = xr.open_dataset('/data/sallen/results/MEOPAR/202007/202007F/SalishSea_04324320_restart.nc')
restart_file
ib, ie = 40, 60
uveln19 = restart_file.un[0, 25-1]
uvelb19 = restart_file.ub[0, 25-1]
uvelb19[896, ib:ie].plot(label="Before 1", linewidth=5)
uveln19[896, ib:ie].plot(label="Next 1")
uvelb19[894, ib:ie].plot(label="Before 3", linewidth=5)
uveln19[894, ib:ie].plot(label="Next 3")
plt.plot([45-ib, 45-ib], [-0.5, 2], color='k');
plt.legend();
restart_file.un[0, :, 896, :] = restart_file.un[0, :, 895, :]
restart_file.ub[0, :, 896, :] = restart_file.ub[0, :, 895, :]
restart_file.vn[0, :, 895, :] = restart_file.vn[0, :, 894, :]
restart_file.vb[0, :, 895, :] = restart_file.vb[0, :, 894, :]
restart_file.attrs['Modified'] = 'copied velocity one away from north boundary to boundary'
restart_file.attrs
restart_file.to_netcdf('SalishSea_04324320_restart.nc')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13465553235908143, 'fraction_numerical': 0.10542797494780794, 'mean_word_length': 6.2784810126582276, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '97667', 'license': 'Apache-2.0', 'n_tokens_mistral': 1352, 'n_tokens_neox': 1125, 'n_words': 253, 'path': 'notebooks/Crashes/202007F-26jun16.ipynb', 'repo_name': 'SalishSeaCast/analysis-susan', 'size': '2874'}