Notebook to compare Race Rocks lighthouse daily salinity readings with nowcasts.
Lighthouse salinty readings are collected at the daytime high tide. I will compare with both nowcast and spinup daily averages.
Temperature is also available, but it is complicated by the time shift in the high tide and the diurnal vairability in temperature. I will not look at temperature for now, but could come up with a fair comparison later.
import pandas as pd
import numpy as np
import netCDF4 as nc
import matplotlib.pyplot as plt
import datetime
import lighthouses as lh
from dateutil import tz
import seaborn as sns
from nowcast import analyze
from salishsea_tools import tidetools, viz_tools
%matplotlib inline
sns.set_style('darkgrid')
sns.set_color_codes()
grid_B = nc.Dataset('/data/nsoontie/MEOPAR/NEMO-forcing/grid/bathy_meter_SalishSea2.nc')
grid_B_green = nc.Dataset('/data/nsoontie/MEOPAR/NEMO-forcing/grid/bathy_downonegrid2.nc')
to_nowcast = datetime.datetime(2016,1,1)
tf_nowcast = datetime.datetime(2016,11,1)
to_spin = datetime.datetime(2003,1,1)
tf_spin = datetime.datetime(2003,12,31)
lighthouse = 'Race Rocks'
fig = lh.monthly_means(lighthouse,grid_B)
fig = lh.compare_model(to_nowcast,tf_nowcast,lighthouse,'nowcast','1h',grid_B)
fig = lh.compare_model(to_nowcast,tf_nowcast,lighthouse,'nowcast-green','1h',grid_B_green)
fig = lh.compare_model(to_spin,tf_spin,lighthouse,'spinup','1d',grid_B)
smin=15; smax=32
tmin=0; tmax=25
lighthouse = 'Entrance Island'
fig = lh.monthly_means(lighthouse,grid_B,smin=smin,smax=smax,tmin=tmin,tmax=tmax)
fig = lh.compare_model(to_nowcast,tf_nowcast,lighthouse,'nowcast','1h',grid_B,smin=smin,smax=smax,tmin=tmin,tmax=tmax)
fig = lh.compare_model(to_nowcast,tf_nowcast,lighthouse,'nowcast-green','1h',grid_B_green,smin=smin,smax=smax,tmin=tmin,tmax=tmax)
fig = lh.compare_model(to_spin,tf_spin,lighthouse,'spinup','1d',grid_B,smin=smin,smax=smax,tmin=tmin,tmax=tmax)
Spin up year much too fresh. Nowcast looks reasonable
smin=23; smax=30
tmin=0; tmax=25
lighthouse = 'Chrome Island'
fig = lh.monthly_means(lighthouse,grid_B,smin=smin,smax=smax,tmin=tmin,tmax=tmax)
fig = lh.compare_model(to_nowcast,tf_nowcast,lighthouse,'nowcast','1h',grid_B,smin=smin,smax=smax,tmin=tmin,tmax=tmax)
fig = lh.compare_model(to_nowcast,tf_nowcast,lighthouse,'nowcast-green','1h',grid_B_green,smin=smin,smax=smax,tmin=tmin,tmax=tmax)
fig = lh.compare_model(to_spin,tf_spin,lighthouse,'spinup','1d',grid_B,smin=smin,smax=smax,tmin=tmin,tmax=tmax)