<jupyter_start><jupyter_text>Model mean sea level - nowcasts* What is the mean sea level of the model?* Is it close to 0? * Trying to determine if z=0 in the model corresponds to mean sea level.<jupyter_code>import numpy as np
import netCDF4 as nc

from salishsea_tools import tidetools
from nowcast import analyze, figures
import datetime
b = '/data/nsoontie/MEOPAR/NEMO-forcing/grid/bathy_meter_SalishSea.nc'

grid_B = nc.Dataset(b)
X=grid_B.variables['nav_lon'][:]
Y=grid_B.variables['nav_lat'][:]
bathy =grid_B.variables['Bathymetry'][:]

to=datetime.datetime(2014,11,1)
tf=datetime.datetime(2015,11,1)
files = analyze.get_filenames(to,tf,'1d','grid_T','/results/SalishSea/nowcast/')<jupyter_output><empty_output><jupyter_text>Look up mean sea level at a few points in the model.<jupyter_code>names = ['<NAME>','<NAME>',  'Victoria', 'Neah Bay', 'Cherry Point', 'Friday Harbor',
        'Sandheads']

print('Date range: {} to {} '.format(to.strftime('%d-%b-%Y'), tf.strftime('%d-%b-%Y')))
for name in names:
    lat = figures.SITES[name]['lat']
    lon = figures.SITES[name]['lon']

    j, i = tidetools.find_closest_model_point(lon,lat,X,Y,bathy) 

    ssh, time =analyze.combine_files(files,'sossheig','None',j,i)
    
    print('{} mean ssh: {}'.format(name, np.mean(ssh)))<jupyter_output>Date range: 01-Nov-2014 to 01-Nov-2015 
Point Atkinson mean ssh: 0.13173380494117737
Campbell River mean ssh: 0.003260144731029868
Victoria mean ssh: 0.015397900715470314
Neah Bay mean ssh: -0.03320030868053436
Cherry Point mean ssh: 0.07652103155851364
Friday Harbor mean ssh: 0.027068471536040306
Sandheads mean ssh: 0.11467214673757553<jupyter_text>Do these values reflect anamolies unqiue to this time period? Probably not, because I would expect them to be closer together.  How do the actual water levels compare with a long term mean sea level?<jupyter_code>DFO = ['Point Atkinson', 'Campbell River', 'Victoria']

print('Date range: {}  to {} '.format(to.strftime('%d-%b-%Y'), tf.strftime('%d-%b-%Y')))

for name in DFO:
    obs = figures.load_archived_observations(name,to.strftime('%d-%b-%Y'), tf.strftime('%d-%b-%Y'))
    print('{} mean sea level - long term mean: {}'.format(name, np.mean(obs.wlev) - figures.SITES[name]['msl']))

NOAA = ['Neah Bay', 'Cherry Point', 'Friday Harbor']    
for name in NOAA:
    obs = figures.get_NOAA_wlevels(figures.SITES[name]['stn_no'],to.strftime('%d-%b-%Y'), tf.strftime('%d-%b-%Y'),
                                  product='hourly_height')
    print('{} mean sea level of observations {}'.format(name, np.mean(obs.wlev) ))<jupyter_output>Date range: 01-Nov-2014  to 01-Nov-2015 
Point Atkinson mean sea level - long term mean: 0.07637214611871634
Campbell River mean sea level - long term mean: -0.04384157059696836
Victoria mean sea level - long term mean: 0.08821868597186078
Neah Bay mean sea level of observations -0.01021948998178506
Cherry Point mean sea level of observations 0.035831056466302275
Friday Harbor mean sea level of observations 0.07147609289617474
{'fraction_non_alphanumeric': 0.14063018242122718, 'fraction_numerical': 0.09286898839137644, 'mean_word_length': 5.0199600798403194, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '300577', 'license': 'Apache-2.0', 'n_tokens_mistral': 1300, 'n_tokens_neox': 1072, 'n_words': 282, 'path': 'Nancy/nowcast/Model Mean Sea Level - nowcasts.ipynb', 'repo_name': 'SalishSeaCast/analysis', 'size': '3031'}