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': '/results/SalishSea/nowcast/',
'spinup': '/results/SalishSea/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)
data_fall = data[(data.Year>=2014) & (data.Month >=10) ]
fig,axm = plt.subplots(1,figsize=(8,5))
data_fall.plot(x='Longitude',y='Latitude',kind='scatter', marker='o',ax=axm)
viz_tools.plot_coastline(axm,grid_B,coords='map')
/home/nsoontie/anaconda3/envs/py2/lib/python2.7/site-packages/matplotlib/collections.py:650: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison if self._edgecolors_original != str('face'):
<matplotlib.contour.QuadContourSet instance at 0x7f5d23108b48>
/home/nsoontie/anaconda3/envs/py2/lib/python2.7/site-packages/matplotlib/collections.py:590: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison if self._edgecolors == str('face'):
data_fall.hist('Month',bins=np.arange(0.5,13.5))
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f5d22ddbbd0>]], dtype=object)
data_fall.hist('Day')
array([[<matplotlib.axes._subplots.AxesSubplot object at 0x7f5d22ccc590>]], dtype=object)
lon_min=-124
lon_max=-123
lat_min=48.8
lat_max=49.35
data_SOG = comparisons.isolate_region(data_fall,lon_min, lon_max, lat_min, lat_max)
zmax= 50
grouped = data_SOG.groupby('Month')
model_year=2014
for month in grouped.groups.keys():
fig = comparisons.compare_model_obs(month,model_year,'Salinity',data_SOG,paths['nowcast'],zmax=zmax,vmin=10,
vmax=31.5, xmin=lon_min,xmax=lon_max,ymin=lat_min,ymax=lat_max)
No model data for 1/10 No model data for 1/10 No model data for 2/10 No model data for 2/10 No model data for 3/10 No model data for 3/10 No model data for 2/10 No model data for 3/10
month=10
fig=comparisons.compare_cast_hourly(month,2014,'Salinity',data_SOG,paths['nowcast'],zmax=zmax,vmin=10,vmax=31.5,
xmin=lon_min,xmax=lon_max,ymin=lat_min,ymax=lat_max)
In late October, most of the surface water in the southern Strait of Georgia is too salty.
month=12
fig=comparisons.compare_cast_hourly(month,2014,'Salinity',data_SOG,paths['nowcast'],zmax=zmax,vmin=10,vmax=31.5,
xmin=lon_min,xmax=lon_max,ymin=lat_min,ymax=lat_max)
lon_min=-125.1
lon_max=-123
lat_min=49.35
lat_max=50
data_SOGN = comparisons.isolate_region(data_fall,lon_min, lon_max, lat_min, lat_max)
zmax= 50
grouped = data_SOGN.groupby('Month')
model_year=2014
for month in grouped.groups.keys():
fig = comparisons.compare_model_obs(month,model_year,'Salinity',data_SOGN,paths['nowcast'],zmax=zmax,vmin=10,
vmax=31.5, xmin=lon_min,xmax=lon_max,ymin=lat_min,ymax=lat_max)
No model data for 1/10 No model data for 4/10 No model data for 4/10 No model data for 5/10 No model data for 5/10 No model data for 5/10 No model data for 6/10 No model data for 7/10 No model data for 7/10 No model data for 8/10 No model data for 8/10
month = 10
fig=comparisons.compare_cast_hourly(month,2014,'Salinity',data_SOGN,paths['nowcast'],zmax=zmax,vmin=20,vmax=31.5,
xmin=lon_min,xmax=lon_max,ymin=lat_min,ymax=lat_max)
lon_min=-125
lon_max=-123
lat_min=48
lat_max=48.48
data_JDF = comparisons.isolate_region(data_fall,lon_min, lon_max, lat_min, lat_max)
zmax= 200
grouped = data_JDF.groupby('Month')
model_year=2014
for month in grouped.groups.keys():
fig = comparisons.compare_model_obs(month,model_year,'Salinity',data_JDF,paths['nowcast'],zmax=zmax,vmin=30,
vmax=34, xmin=lon_min,xmax=lon_max,ymin=lat_min,ymax=lat_max)
No model data for 16/10 No model data for 16/10 No model data for 16/10
month = 10
fig=comparisons.compare_cast_hourly(month,2014,'Salinity',data_JDF,paths['nowcast'],zmax=zmax,vmin=30,vmax=34,
xmin=lon_min,xmax=lon_max,ymin=lat_min,ymax=lat_max)
lon_min=-123.49
lon_max=-122
lat_min=48.48
lat_max=48.8
data_haro = comparisons.isolate_region(data_fall,lon_min, lon_max, lat_min, lat_max)
zmax= 300
grouped = data_haro.groupby('Month')
model_year=2014
for month in grouped.groups.keys():
fig = comparisons.compare_model_obs(month,model_year,'Salinity',data_haro,paths['nowcast'],zmax=zmax,
vmin=28,vmax=32, xmin=lon_min,xmax=lon_max,ymin=lat_min,ymax=lat_max)
month = 10
fig=comparisons.compare_cast_hourly(month,2014,'Salinity',data_haro,paths['nowcast'],
zmax=zmax,vmin=28,vmax=32,
xmin=lon_min,xmax=lon_max,ymin=lat_min,ymax=lat_max)