<jupyter_start><jupyter_text>This notebook deals with the instability arising out using the frs BC for traces and tries to find out if there is a mismatch between the input T and S and that at our boundaries at the time when the model is initialised (IC state is equal to the BC at time t = 0)<jupyter_code>%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import netCDF4 as nc
import xarray as xr
import matplotlib.cm as cm
from scipy.interpolate import interp1d
from salishsea_tools import (nc_tools, gsw_calls, viz_tools)<jupyter_output><empty_output><jupyter_text>Let us load the IC for our NEMO model<jupyter_code>IC_file = nc.Dataset('/ocean/ssahu/CANYONS/wcvi/initial_conditions/West_coast_NEMO_IC_temperature_salinity_nomask_JP.nc')
votem_IC = IC_file.variables['votemper'][:];
vosal_IC = IC_file.variables['vosaline'][:];
votem_IC.shape<jupyter_output><empty_output><jupyter_text>Now let us load the T and S for the BC file (Let's begin the excersize by loading only the BC file of the west boundary)<jupyter_code>BC_west = nc.Dataset('/ocean/ssahu/CANYONS/bdy_files/3d_NEMO_west_m04.nc');
votem_west_BC = BC_west.variables['votemper'][:];
vosal_west_BC = BC_west.variables['vosaline'][:];
votem_west_BC.shape<jupyter_output><empty_output><jupyter_text>By principle the outer values at the very first time step should be equal to the value of the IC (let's test that)<jupyter_code>BC_check = votem_west_BC[0,:,:,:]; print(BC_check.shape)

IC_check = votem_IC[0,:,:]; print (IC_check.shape)
np.mean(BC_check)
np.mean(IC_check[:,:,:4])<jupyter_output><empty_output><jupyter_text>So they are not same and our fears just became real<jupyter_code>BC_check[0,...]
np.where(IC_check[0,...] == np.max(IC_check[0,...]))
BC_check[0,0,0]
np.where(IC_check[0,...] == BC_check[0,...])
np.where(BC_check[0,...] == np.max(BC_check[0,...]))
IC_check[0,0,60]
BC_check[0,3,5]
np.where(BC_check == IC_check)<jupyter_output>/home/ssahu/anaconda3/lib/python3.5/site-packages/ipykernel/__main__.py:1: DeprecationWarning: elementwise == comparison failed; this will raise an error in the future.
  if __name__ == '__main__':
{'fraction_non_alphanumeric': 0.12441314553990611, 'fraction_numerical': 0.014084507042253521, 'mean_word_length': 6.5836298932384345, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 20, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '311978', 'license': 'Apache-2.0', 'n_tokens_mistral': 822, 'n_tokens_neox': 805, 'n_words': 196, 'path': 'grid/Dealing_with_FRS_initial_T_and_S.ipynb', 'repo_name': 'UBC-MOAD/wcvi', 'size': '2130'}