Compare a single cast from IOS observations to model.
IOS observations span many years. So, cbservations with model on day of, 7 days before and 7 days after. This can account for spring/neap variability but not interannual variabilty in discharge, winds, etc
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import ACTDR
import netCDF4 as nc
from salishsea_tools import viz_tools
import numpy as np
import datetime
from salishsea_tools import tidetools
import comparisons
%matplotlib inline
sns.set_style('darkgrid')
grid_B = nc.Dataset('/data/nsoontie/MEOPAR/NEMO-forcing/grid/bathy_meter_SalishSea2.nc')
paths = {'nowcast': '/data/dlatorne/MEOPAR/SalishSea/nowcast/',
'spinup': '/ocean/dlatorne/MEOPAR/SalishSea/results/spin-up/'}
ACTDR.load_dat('SOG_2000.dat')
> open SOG_2000.dat > load CTD_DAT > load STANDARD_KEYS > close SOG_2000.dat > complete
data = pd.DataFrame(ACTDR.CTD_DAT)
lon_min=-124.6; lat_min=48;
lon_max=-123.6; lat_max=48.6;
data_region = comparisons.isolate_region(data, lon_min, lon_max, lat_min, lat_max)
fig,axm = plt.subplots(1,figsize=(8,5))
data_region.plot(x='Longitude',y='Latitude',kind='scatter', marker='o',ax=axm)
viz_tools.plot_coastline(axm,grid_B,coords='map')
axm.set_xlim([lon_min,lon_max])
axm.set_ylim([lat_min, lat_max])
(48, 48.6)
data_region.hist('Month',bins=np.arange(0.5,13.5))
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f9621d13590>]], dtype=object)
data_region.hist('Year', bins= np.arange(data_region['Year'].min()-0.5, data_region['Year'].max() +1.5 ))
ax=plt.gca()
ax.get_xaxis().get_major_formatter().set_useOffset(False)
lon_min=-123.9; lat_min=48;
lon_max=-123.6; lat_max=48.6;
data_east = comparisons.isolate_region(data, lon_min, lon_max, lat_min, lat_max)
fig,axm = plt.subplots(1,figsize=(8,5))
data_east.plot(x='Longitude',y='Latitude',kind='scatter', marker='o',ax=axm)
viz_tools.plot_coastline(axm,grid_B,coords='map')
axm.set_xlim([-124.5,lon_max])
axm.set_ylim([lat_min, lat_max])
(48, 48.6)
data_east.hist('Month',bins=np.arange(0.5,13.5))
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f9620b6e750>]], dtype=object)
data_east.hist('Year', bins= np.arange(data_region['Year'].min()-0.5, data_region['Year'].max() +1.5 ))
ax=plt.gca()
ax.get_xaxis().get_major_formatter().set_useOffset(False)
zmax= 200
grouped = data_east.groupby('Month')
for month in grouped.groups.keys():
if month != 8 and month != 9 and month != 10:
if month ==11 or month ==12:
model_year=2014
else:
model_year=2015
fig = comparisons.compare_model_obs(month,model_year,'Salinity',data_east,paths['nowcast'],zmax=zmax,vmin=30,
vmax=34, xmin=-124.5,xmax=lon_max,ymin=lat_min,ymax=lat_max)
lon_min=-124.3; lat_min=48;
lon_max=-123.9; lat_max=48.6;
data_central = comparisons.isolate_region(data, lon_min, lon_max, lat_min, lat_max)
fig,axm = plt.subplots(1,figsize=(8,5))
data_central.plot(x='Longitude',y='Latitude',kind='scatter', marker='o',ax=axm)
viz_tools.plot_coastline(axm,grid_B,coords='map')
axm.set_xlim([-124.5,-123.6])
axm.set_ylim([lat_min, lat_max])
(48, 48.6)
data_central.hist('Month',bins=np.arange(0.5,13.5))
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f96223bf610>]], dtype=object)
data_central.hist('Year', bins= np.arange(data_region['Year'].min()-0.5, data_region['Year'].max() +1.5 ))
ax=plt.gca()
ax.get_xaxis().get_major_formatter().set_useOffset(False)
zmax= 200
grouped = data_central.groupby('Month')
for month in grouped.groups.keys():
if month != 8 and month != 9 and month != 10:
if month ==11 or month ==12:
model_year=2014
else:
model_year=2015
fig = comparisons.compare_model_obs(month,model_year,'Salinity',data_central,paths['nowcast'],zmax=zmax,vmin=30,
vmax=34, xmin=-124.5,xmax=-123.6,ymin=lat_min,ymax=lat_max)
lon_min=-124.5; lat_min=48;
lon_max=-124.3; lat_max=48.6;
data_west = comparisons.isolate_region(data, lon_min, lon_max, lat_min, lat_max)
fig,axm = plt.subplots(1,figsize=(8,5))
data_west.plot(x='Longitude',y='Latitude',kind='scatter', marker='o',ax=axm)
viz_tools.plot_coastline(axm,grid_B,coords='map')
axm.set_xlim([-124.5,-123.6])
axm.set_ylim([lat_min, lat_max])
(48, 48.6)
data_west.hist('Month',bins=np.arange(0.5,13.5))
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f9621bac110>]], dtype=object)
data_west.hist('Year', bins= np.arange(data_region['Year'].min()-0.5, data_region['Year'].max() +1.5 ))
ax=plt.gca()
ax.get_xaxis().get_major_formatter().set_useOffset(False)
zmax= 200
grouped = data_west.groupby('Month')
for month in grouped.groups.keys():
if month != 8 and month != 9 and month != 10:
if month ==11 or month ==12:
model_year=2014
else:
model_year=2015
fig = comparisons.compare_model_obs(month,model_year,'Salinity',data_west,paths['nowcast'],zmax=zmax,vmin=25,
vmax=34, xmin=-124.5,xmax=-123.6,ymin=lat_min,ymax=lat_max)
These comparisons are still difficult. Let's separate each cast out. Focus on the eastern Juan de Fuca region.
Question - Are we too salty in the surface?
Plot 7 days before and after cast yeardate to attempt to capture spring/neap variability.
month = 11
xmin=-124.5; xmax=-123.6
fig=comparisons.compare_cast_model(month,2014,'Salinity',data_east,paths['nowcast'],zmax=zmax,vmin=30,vmax=34,
xmin=xmin,xmax=xmax,ymin=lat_min,ymax=lat_max)
month = 2
fig=comparisons.compare_cast_model(month,2015,'Salinity',data_east,paths['nowcast'],zmax=zmax,vmin=30,vmax=34,
xmin=xmin,xmax=xmax,ymin=lat_min,ymax=lat_max)
month = 3
fig=comparisons.compare_cast_model(month,2015,'Salinity',data_east,paths['nowcast'],zmax=zmax,vmin=30,vmax=34,
xmin=xmin,xmax=xmax,ymin=lat_min,ymax=lat_max)
month = 4
fig=comparisons.compare_cast_model(month,2015,'Salinity',data_east,paths['nowcast'],zmax=zmax,vmin=30,vmax=34,
xmin=xmin,xmax=xmax,ymin=lat_min,ymax=lat_max)
month = 6
fig=comparisons.compare_cast_model(month,2015,'Salinity',data_east,paths['nowcast'],zmax=zmax,vmin=30,vmax=34,
xmin=xmin,xmax=xmax,ymin=lat_min,ymax=lat_max)
month = 7
fig=comparisons.compare_cast_model(month,2015,'Salinity',data_east,paths['nowcast'],zmax=zmax,vmin=30,vmax=34,
xmin=xmin,xmax=xmax,ymin=lat_min,ymax=lat_max)
Model deep is consistently fresher.
Does the interannual variability of the Fraser River discharge affect the surface salinty in the Strait of Juan de Fuca? I see quite a lot of variablity in the observed JdF surface waters. Is this because of discharge or spring/neap tides.
Ideally, we would have time overlap in model/data comparisons.
I'm struggling to find a consistent trend but will attempt to summarize the eastern region.
I was expecting to see a consistently saltier model in the surface waters (because of too much mixing) but didn't. Why?