on 83rd time step goes NaN (physics) 84th (biology)
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();
<matplotlib.collections.QuadMesh at 0x7f69404db760>
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();
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.
gT.sossheig[0].plot(vmax=1, vmin=-1, cmap='plasma');
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 = xr.open_dataset('/home/sallen/MEOPAR/Tools/I_ForcingFiles/Rivers/ncfiles/R202102Dailies_y2016m06d26.nc')
rivers
<xarray.Dataset> Dimensions: (time_counter: 1, x: 398, y: 898) Coordinates: * x (x) int64 0 1 2 3 4 5 6 7 ... 390 391 392 393 394 395 396 397 * y (y) int64 0 1 2 3 4 5 6 7 ... 890 891 892 893 894 895 896 897 * time_counter (time_counter) int64 0 Data variables: rorunoff (time_counter, y, x) float64 ... Attributes: acknowledgements: Based on river fit creator_email: sallen@eoas.ubc.ca creator_name: Salish Sea MEOPAR Project Contributors creator_url: https://salishsea-meopar-docs.readthedocs.org/ institution: UBC EOAS institution_fullname: Earth, Ocean & Atmospheric Sciences, University of... title: Rivers for y2016m06d26 notebook: MakeDailyRiverNCfiles.ipynb rivers_base: river_202101 summary: Daily Runoff history: [2021-02-02] File creation.
array([ 0, 1, 2, ..., 395, 396, 397])
array([ 0, 1, 2, ..., 895, 896, 897])
array([0])
[357404 values with dtype=float64]
rivers.rorunoff.max()
<xarray.DataArray 'rorunoff' ()> array(24.70158577)
array(24.70158577)
rivers.rorunoff.min()
<xarray.DataArray 'rorunoff' ()> array(0.)
array(0.)
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
<xarray.Dataset> Dimensions: (time_counter: 24, xbT: 100, yb: 1) Coordinates: * time_counter (time_counter) datetime64[ns] 2016-06-26T01:00:00 ... 2016-... * xbT (xbT) int64 0 1 2 3 4 5 6 7 8 9 ... 91 92 93 94 95 96 97 98 99 * yb (yb) int64 0 Data variables: nbidta (yb, xbT) int64 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 nbjdta (yb, xbT) int64 371 372 373 374 375 ... 466 467 468 469 470 nbrdta (yb, xbT) int64 0 0 0 0 0 0 0 0 0 0 0 ... 0 0 0 0 0 0 0 0 0 0 sossheig (time_counter, yb, xbT) float64 -0.2634 -0.2634 ... -0.2572 vobtcrtx (time_counter, yb, xbT) float64 0.0 0.0 0.0 ... 0.0 0.0 0.0 vobtcrty (time_counter, yb, xbT) float64 0.0 0.0 0.0 ... 0.0 0.0 0.0 Attributes: Conventions: CF-1.6 title: Juan de Fuca SSH hourly values institution: Dept of Earth, Ocean & Atmospheric Sciences, University of ... source: REQUIRED references: REQUIRED history: Mon Mar 12 08:05:16 2018: ncks -O --mk_rec_dmn time_counter... comment: Neah Bay observed anomaly. Done in hindcast. NCO: 4.4.2
array(['2016-06-26T01:00:00.000000000', '2016-06-26T02:00:00.000000000', '2016-06-26T03:00:00.000000000', '2016-06-26T04:00:00.000000000', '2016-06-26T05:00:00.000000000', '2016-06-26T06:00:00.000000000', '2016-06-26T07:00:00.000000000', '2016-06-26T08:00:00.000000000', '2016-06-26T09:00:00.000000000', '2016-06-26T10:00:00.000000000', '2016-06-26T11:00:00.000000000', '2016-06-26T12:00:00.000000000', '2016-06-26T13:00:00.000000000', '2016-06-26T14:00:00.000000000', '2016-06-26T15:00:00.000000000', '2016-06-26T16:00:00.000000000', '2016-06-26T17:00:00.000000000', '2016-06-26T18:00:00.000000000', '2016-06-26T19:00:00.000000000', '2016-06-26T20:00:00.000000000', '2016-06-26T21:00:00.000000000', '2016-06-26T22:00:00.000000000', '2016-06-26T23:00:00.000000000', '2016-06-27T00:00:00.000000000'], dtype='datetime64[ns]')
array([ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99])
array([0])
array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])
array([[371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 384, 385, 386, 387, 388, 389, 390, 391, 392, 393, 394, 395, 396, 397, 398, 399, 400, 401, 402, 403, 404, 405, 406, 407, 408, 409, 410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421, 422, 423, 424, 425, 426, 427, 428, 429, 430, 431, 432, 433, 434, 435, 436, 437, 438, 439, 440, 441, 442, 443, 444, 445, 446, 447, 448, 449, 450, 451, 452, 453, 454, 455, 456, 457, 458, 459, 460, 461, 462, 463, 464, 465, 466, 467, 468, 469, 470]])
array([[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]])
array([[[-0.263449, -0.263449, ..., -0.263449, -0.263449]], [[-0.23731 , -0.23731 , ..., -0.23731 , -0.23731 ]], ..., [[-0.242872, -0.242872, ..., -0.242872, -0.242872]], [[-0.257177, -0.257177, ..., -0.257177, -0.257177]]])
array([[[0., 0., ..., 0., 0.]], [[0., 0., ..., 0., 0.]], ..., [[0., 0., ..., 0., 0.]], [[0., 0., ..., 0., 0.]]])
array([[[0., 0., ..., 0., 0.]], [[0., 0., ..., 0., 0.]], ..., [[0., 0., ..., 0., 0.]], [[0., 0., ..., 0., 0.]]])
ssh.sossheig[:, 0, 40].plot()
sshb.sossheig[:, 0, 40].plot()
[<matplotlib.lines.Line2D at 0x7f69305d6760>]
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
<xarray.Dataset> Dimensions: (t: 1, x: 398, y: 898, z: 40) Dimensions without coordinates: t, x, y, z Data variables: nav_lon (y, x) float32 ... nav_lat (y, x) float32 ... nav_lev (z) float32 0.5 1.5 2.5 3.5 4.5 ... 360.7 387.6 414.5 441.5 time_counter (t) float64 4.324e+06 kt float64 4.324e+06 ndastp float64 2.016e+07 adatrj float64 2.002e+03 ssh_ibb (t, y, x) float64 ... rnf_b (t, y, x) float64 ... rnf_hc_b (t, y, x) float64 ... rnf_sc_b (t, y, x) float64 ... utau_b (t, y, x) float64 ... vtau_b (t, y, x) float64 ... qns_b (t, y, x) float64 ... emp_b (t, y, x) float64 ... sfx_b (t, y, x) float64 ... en (t, z, y, x) float64 ... avt (t, z, y, x) float64 ... avm (t, z, y, x) float64 ... avmu (t, z, y, x) float64 ... avmv (t, z, y, x) float64 ... mxln (t, z, y, x) float64 ... ub2_b (t, y, x) float64 ... vb2_b (t, y, x) float64 ... sbc_hc_b (t, y, x) float64 ... sbc_sc_b (t, y, x) float64 ... qsr_hc_b (t, z, y, x) float64 ... fraqsr_1lev (t, y, x) float64 ... fse3t_b (t, z, y, x) float64 ... fse3t_n (t, z, y, x) float64 ... rdt float64 40.0 rdttra1 float64 40.0 ub (t, z, y, x) float64 ... vb (t, z, y, x) float64 ... tb (t, z, y, x) float64 ... sb (t, z, y, x) float64 ... rotb (t, z, y, x) float64 ... hdivb (t, z, y, x) float64 ... sshb (t, y, x) float64 ... un (t, z, y, x) float64 ... vn (t, z, y, x) float64 ... tn (t, z, y, x) float64 ... sn (t, z, y, x) float64 ... rotn (t, z, y, x) float64 ... hdivn (t, z, y, x) float64 ... sshn (t, y, x) float64 ... rhop (t, z, y, x) float64 ... Attributes: file_name: SalishSea_04324320_restart.nc TimeStamp: 21/03/2021 02:40:06 -0700
[357404 values with dtype=float32]
[357404 values with dtype=float32]
array([ 0.5 , 1.500003, 2.500011, 3.500031, 4.500071, 5.500151, 6.50031 , 7.500623, 8.501236, 9.502433, 10.504766, 11.509312, 12.518167, 13.535412, 14.568982, 15.634288, 16.761173, 18.007135, 19.481785, 21.389978, 24.100256, 28.229916, 34.685757, 44.517723, 58.484333, 76.58559 , 98.06296 , 121.866516, 147.08946 , 173.11449 , 199.57304 , 226.2603 , 253.06664 , 279.93454 , 306.8342 , 333.75018 , 360.67453 , 387.6032 , 414.5341 , 441.4661 ], dtype=float32)
array([4324320.])
array(4324320.)
array(20160625.)
array(2002.)
[357404 values with dtype=float64]
[357404 values with dtype=float64]
[357404 values with dtype=float64]
[357404 values with dtype=float64]
[357404 values with dtype=float64]
[357404 values with dtype=float64]
[357404 values with dtype=float64]
[357404 values with dtype=float64]
[357404 values with dtype=float64]
[14296160 values with dtype=float64]
[14296160 values with dtype=float64]
[14296160 values with dtype=float64]
[14296160 values with dtype=float64]
[14296160 values with dtype=float64]
[14296160 values with dtype=float64]
[357404 values with dtype=float64]
[357404 values with dtype=float64]
[357404 values with dtype=float64]
[357404 values with dtype=float64]
[14296160 values with dtype=float64]
[357404 values with dtype=float64]
[14296160 values with dtype=float64]
[14296160 values with dtype=float64]
array(40.)
array(40.)
[14296160 values with dtype=float64]
[14296160 values with dtype=float64]
[14296160 values with dtype=float64]
[14296160 values with dtype=float64]
[14296160 values with dtype=float64]
[14296160 values with dtype=float64]
[357404 values with dtype=float64]
[14296160 values with dtype=float64]
[14296160 values with dtype=float64]
[14296160 values with dtype=float64]
[14296160 values with dtype=float64]
[14296160 values with dtype=float64]
[14296160 values with dtype=float64]
[357404 values with dtype=float64]
[14296160 values with dtype=float64]
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
{'file_name': 'SalishSea_04324320_restart.nc', 'TimeStamp': '21/03/2021 02:40:06 -0700', 'Modified': 'copied velocity one away from north boundary to boundary'}
restart_file.to_netcdf('SalishSea_04324320_restart.nc')
Looks like its running okay now.