Comparisons between nowcast, spinup, and observed salinity in the Haro Strait
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 comparisons
%matplotlib inline
sns.set_style('darkgrid')
grid_B = nc.Dataset('/data/nsoontie/MEOPAR/NEMO-forcing/grid/bathy_meter_SalishSea2.nc')
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=-123.4; lat_min=48.3;
lon_max=-123; lat_max=48.85;
data_region = comparisons.isolate_region(data, lon_min, lon_max, lat_min, lat_max)
fig,axm = plt.subplots(1,figsize=(5,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.3, 48.85)
data_region.hist('Month',bins=np.arange(0.5,13.5))
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7fccf475a810>]], 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)
paths = {'nowcast': '/data/dlatorne/MEOPAR/SalishSea/nowcast/',
'spinup': '/ocean/dlatorne/MEOPAR/SalishSea/results/spin-up/'}
zmax= 250
November
month=11
fig=comparisons.compare_model_obs(month,2003,'Salinity',data_region,paths['spinup'],zmax=zmax,vmin=24,vmax=33,
xmin=lon_min,xmax=lon_max,ymin=lat_min,ymax=lat_max)
fig=comparisons.compare_model_obs(month,2014,'Salinity',data_region,paths['nowcast'],zmax=zmax, vmin=24,vmax=33,
xmin=lon_min,xmax=lon_max,ymin=lat_min,ymax=lat_max)
data_month=data_region[data_region['Month']==month]
data_month.hist('Year',bins = np.arange(data_month['Year'].min()-0.5,data_month['Year'].max()+1.5 ))
ax=plt.gca()
ax.get_xaxis().get_major_formatter().set_useOffset(False)
December
month=12
fig=comparisons.compare_model_obs(month,2003,'Salinity',data_region,paths['spinup'],zmax=zmax,vmin=24,vmax=33,
xmin=lon_min,xmax=lon_max,ymin=lat_min,ymax=lat_max)
fig=comparisons.compare_model_obs(month,2014,'Salinity',data_region,paths['nowcast'],zmax=zmax, vmin=24,vmax=33,
xmin=lon_min,xmax=lon_max,ymin=lat_min,ymax=lat_max)
data_month=data_region[data_region['Month']==month]
data_month.hist('Year',bins = np.arange(data_month['Year'].min()-0.5,data_month['Year'].max()+1.5 ))
ax=plt.gca()
ax.get_xaxis().get_major_formatter().set_useOffset(False)
Hypothesis is too much mixing here. But some model profiles are stratified more than the observations. Certainly there is a strong freshening trend in the deeper water. But is that because of too much mixing or too much fresh water?
January
month=1
fig=comparisons.compare_model_obs(month,2003,'Salinity',data_region,paths['spinup'],zmax=zmax,vmin=24,vmax=33,
xmin=lon_min,xmax=lon_max,ymin=lat_min,ymax=lat_max)
fig=comparisons.compare_model_obs(month,2015,'Salinity',data_region,paths['nowcast'],zmax=zmax, vmin=24,vmax=33,
xmin=lon_min,xmax=lon_max,ymin=lat_min,ymax=lat_max)
data_month=data_region[data_region['Month']==month]
data_month.hist('Year',bins = np.arange(data_month['Year'].min()-0.5,data_month['Year'].max()+1.5 ))
ax=plt.gca()
ax.get_xaxis().get_major_formatter().set_useOffset(False)
February
month=2
fig=comparisons.compare_model_obs(month,2003,'Salinity',data_region,paths['spinup'],zmax=zmax,vmin=24,vmax=33,
xmin=lon_min,xmax=lon_max,ymin=lat_min,ymax=lat_max)
fig=comparisons.compare_model_obs(month,2015,'Salinity',data_region,paths['nowcast'],zmax=zmax, vmin=24,vmax=33,
xmin=lon_min,xmax=lon_max,ymin=lat_min,ymax=lat_max)
data_month=data_region[data_region['Month']==month]
data_month.hist('Year',bins = np.arange(data_month['Year'].min()-0.5,data_month['Year'].max()+1.5 ))
ax=plt.gca()
ax.get_xaxis().get_major_formatter().set_useOffset(False)
March
month=3
fig=comparisons.compare_model_obs(month,2003,'Salinity',data_region,paths['spinup'],zmax=zmax,vmin=24,vmax=33,
xmin=lon_min,xmax=lon_max,ymin=lat_min,ymax=lat_max)
fig=comparisons.compare_model_obs(month,2015,'Salinity',data_region,paths['nowcast'],zmax=zmax, vmin=24,vmax=33,
xmin=lon_min,xmax=lon_max,ymin=lat_min,ymax=lat_max)
data_month=data_region[data_region['Month']==month]
data_month.hist('Year',bins = np.arange(data_month['Year'].min()-0.5,data_month['Year'].max()+1.5 ))
ax=plt.gca()
ax.get_xaxis().get_major_formatter().set_useOffset(False)
April
month=4
fig=comparisons.compare_model_obs(month,2003,'Salinity',data_region,paths['spinup'],zmax=zmax,vmin=24,vmax=33,
xmin=lon_min,xmax=lon_max,ymin=lat_min,ymax=lat_max)
fig=comparisons.compare_model_obs(month,2015,'Salinity',data_region,paths['nowcast'],zmax=zmax, vmin=24,vmax=33,
xmin=lon_min,xmax=lon_max,ymin=lat_min,ymax=lat_max)
data_month=data_region[data_region['Month']==month]
data_month.hist('Year',bins = np.arange(data_month['Year'].min()-0.5,data_month['Year'].max()+1.5 ))
ax=plt.gca()
ax.get_xaxis().get_major_formatter().set_useOffset(False)
Model surface waters are super fresh here. Again, we see the model freshening in the deep. Compared to spinup, the stratified layer is thicker, but the stratification still seems stronger than mode of the observations.
A lot of data. Maybe look at stations separately because observations are getting covered up.
May - no data
June
month=6
fig=comparisons.compare_model_obs(month,2003,'Salinity',data_region,paths['spinup'],zmax=zmax,vmin=24,vmax=33,
xmin=lon_min,xmax=lon_max,ymin=lat_min,ymax=lat_max)
fig=comparisons.compare_model_obs(month,2015,'Salinity',data_region,paths['nowcast'],zmax=zmax, vmin=24,vmax=33,
xmin=lon_min,xmax=lon_max,ymin=lat_min,ymax=lat_max)
data_month=data_region[data_region['Month']==month]
data_month.hist('Year',bins = np.arange(data_month['Year'].min()-0.5,data_month['Year'].max()+1.5 ))
ax=plt.gca()
ax.get_xaxis().get_major_formatter().set_useOffset(False)
Surface layer fresh in observations. Make sense because of the freshet.
Again, tonnes of data and some observations are covered.
July
month=7
fig=comparisons.compare_model_obs(month,2003,'Salinity',data_region,paths['spinup'],zmax=zmax,vmin=24,vmax=33,
xmin=lon_min,xmax=lon_max,ymin=lat_min,ymax=lat_max)
fig=comparisons.compare_model_obs(month,2015,'Salinity',data_region,paths['nowcast'],zmax=zmax, vmin=24,vmax=33,
xmin=lon_min,xmax=lon_max,ymin=lat_min,ymax=lat_max)
data_month=data_region[data_region['Month']==month]
data_month.hist('Year',bins = np.arange(data_month['Year'].min()-0.5,data_month['Year'].max()+1.5 ))
ax=plt.gca()
ax.get_xaxis().get_major_formatter().set_useOffset(False)
Consider comparing locations individually.
In Haro Strait, it appears we have freshening at all depths. Is that most consistent with
or
data_2014 = data_region[data_region['Year']==2014]
data_2014.hist('Month')
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7fccef723850>]], dtype=object)