Notebook to compare model nowcasts with data from a few ONC moorings. Really, only the JDF AS04 has data overlapping data.
Observations are from Ocean Networks Canada.
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import ONC
from salishsea_tools import tidetools, viz_tools
import netCDF4 as nc
import datetime
from scipy import interpolate as interp
from nowcast import analyze
%matplotlib inline
csvfilename = ('/ocean/nsoontie/MEOPAR/ONC/JDF/'
'JuandeFucaStrait_AS04Mooring_CTD_20131011T230027Z_20161027T212203Z-NaN_clean.csv')
grid_B = {'nowcast': nc.Dataset('/data/nsoontie/MEOPAR/NEMO-forcing/grid/bathy_meter_SalishSea2.nc'),
'nowcast-green': nc.Dataset('/data/nsoontie/MEOPAR/NEMO-forcing/grid/bathy_downonegrid2.nc')}
result_homes = {'nowcast': '/results/SalishSea/nowcast/',
'nowcast-green': '/results/SalishSea/nowcast-green/'}
sdt=datetime.datetime(2014, 11, 1)
edt = datetime.datetime(2016, 10, 28)
figmap, fig = ONC.compare_ONC_model(csvfilename, sdt, edt, grid_B['nowcast'], result_homes['nowcast'],
period='1d', smin=30, smax=35, tmin=7, tmax=11, interp=True)
/data/nsoontie/MEOPAR/analysis-nancy/notebooks/strat/comparisons/ONC.py:37: FutureWarning: convert_objects is deprecated. Use the data-type specific converters pd.to_datetime, pd.to_timedelta and pd.to_numeric. data = data.convert_objects(convert_numeric=True) /data/nsoontie/MEOPAR/analysis-nancy/notebooks/strat/comparisons/ONC.py:205: FutureWarning: how in .resample() is deprecated the new syntax is .resample(...).mean() data_r = data.resample(r, how='mean', base=0.5) /data/nsoontie/MEOPAR/tools/SalishSeaNowcast/nowcast/analyze.py:171: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison if kss == 'None':
Model bathymetry: 117.0 Model bathymetry: 117.0
figmap, fig = ONC.compare_ONC_model(csvfilename, sdt, edt, grid_B['nowcast-green'],
result_homes['nowcast-green'], period='1d',
smin=30, smax=35, tmin=7, tmax=11, interp=True, teos_to_psu=True)
/data/nsoontie/MEOPAR/analysis-nancy/notebooks/strat/comparisons/ONC.py:37: FutureWarning: convert_objects is deprecated. Use the data-type specific converters pd.to_datetime, pd.to_timedelta and pd.to_numeric. data = data.convert_objects(convert_numeric=True) /data/nsoontie/MEOPAR/analysis-nancy/notebooks/strat/comparisons/ONC.py:205: FutureWarning: how in .resample() is deprecated the new syntax is .resample(...).mean() data_r = data.resample(r, how='mean', base=0.5) /data/nsoontie/MEOPAR/tools/SalishSeaNowcast/nowcast/analyze.py:171: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison if kss == 'None':
Model bathymetry: 141.625 Model bathymetry: 141.625
csvfilename = ('/ocean/nsoontie/MEOPAR/ONC/BoundaryPass//'
'BoundaryPass_BoundaryPassMooring_CTD_20130418T192032Z_20161021T231158Z-NaN_clean.csv')
sdt=datetime.datetime(2014,9,24)
edt=datetime.datetime(2016,11,11)
figmap, fig = ONC.compare_ONC_model(csvfilename, sdt, edt, grid_B['nowcast'], result_homes['nowcast'],
period='1d',
interp=False, smin=28, smax=33, tmin=8, tmax=15)
/data/nsoontie/MEOPAR/analysis-nancy/notebooks/strat/comparisons/ONC.py:37: FutureWarning: convert_objects is deprecated. Use the data-type specific converters pd.to_datetime, pd.to_timedelta and pd.to_numeric. data = data.convert_objects(convert_numeric=True) /data/nsoontie/MEOPAR/analysis-nancy/notebooks/strat/comparisons/ONC.py:205: FutureWarning: how in .resample() is deprecated the new syntax is .resample(...).mean() data_r = data.resample(r, how='mean', base=0.5) /data/nsoontie/MEOPAR/tools/SalishSeaNowcast/nowcast/analyze.py:171: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison if kss == 'None':
Model bathymetry: 205.0 Model bathymetry: 205.0
figmap, fig = ONC.compare_ONC_model(csvfilename, sdt, edt, grid_B['nowcast-green'],
result_homes['nowcast-green'],
period='1d',
interp=False, smin=28, smax=33, tmin=8, tmax=15, teos_to_psu=True)
/data/nsoontie/MEOPAR/analysis-nancy/notebooks/strat/comparisons/ONC.py:37: FutureWarning: convert_objects is deprecated. Use the data-type specific converters pd.to_datetime, pd.to_timedelta and pd.to_numeric. data = data.convert_objects(convert_numeric=True) /data/nsoontie/MEOPAR/analysis-nancy/notebooks/strat/comparisons/ONC.py:205: FutureWarning: how in .resample() is deprecated the new syntax is .resample(...).mean() data_r = data.resample(r, how='mean', base=0.5) /data/nsoontie/MEOPAR/tools/SalishSeaNowcast/nowcast/analyze.py:171: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison if kss == 'None':
Model bathymetry: 231.625 Model bathymetry: 231.625
Improvement in nowcast green could be because this grid point is 27 m deeper now.
csvfilename = ('/ocean/nsoontie/MEOPAR/ONC/JDF/'
'JuandeFucaStrait_JFCNMooring_CTD_20131025T180034Z_20150911T234539Z-NaN_clean.csv')
sdt=datetime.datetime(2014,9,24)
edt=datetime.datetime(2015,9,12)
figmap, fig = ONC.compare_ONC_model(csvfilename, sdt, edt, grid_B['nowcast'], result_homes['nowcast'],
period='1d',
interp=True, smin=32, smax=35, tmin=5, tmax=9.5)
/data/nsoontie/MEOPAR/analysis-nancy/notebooks/strat/comparisons/ONC.py:37: FutureWarning: convert_objects is deprecated. Use the data-type specific converters pd.to_datetime, pd.to_timedelta and pd.to_numeric. data = data.convert_objects(convert_numeric=True) /data/nsoontie/MEOPAR/analysis-nancy/notebooks/strat/comparisons/ONC.py:205: FutureWarning: how in .resample() is deprecated the new syntax is .resample(...).mean() data_r = data.resample(r, how='mean', base=0.5) /data/nsoontie/MEOPAR/tools/SalishSeaNowcast/nowcast/analyze.py:171: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison if kss == 'None':
Model bathymetry: 234.375 Model bathymetry: 234.375
csvfilename = ('/ocean/nsoontie/MEOPAR/ONC/JDF/'
'JuandeFucaStrait_MacaulayOutfallMooring_CTD_20140417T173026Z_20161026T235626Z-NaN_clean.csv')
sdt=datetime.datetime(2014,9,24)
edt=datetime.datetime(2016,10,27)
figmap, fig = ONC.compare_ONC_model(csvfilename, sdt, edt, grid_B['nowcast'], result_homes['nowcast'],
period='1d', interp=True,smin=30, smax=33, tmin=8, tmax=12)
/data/nsoontie/MEOPAR/analysis-nancy/notebooks/strat/comparisons/ONC.py:37: FutureWarning: convert_objects is deprecated. Use the data-type specific converters pd.to_datetime, pd.to_timedelta and pd.to_numeric. data = data.convert_objects(convert_numeric=True) /data/nsoontie/MEOPAR/analysis-nancy/notebooks/strat/comparisons/ONC.py:205: FutureWarning: how in .resample() is deprecated the new syntax is .resample(...).mean() data_r = data.resample(r, how='mean', base=0.5) /data/nsoontie/MEOPAR/tools/SalishSeaNowcast/nowcast/analyze.py:171: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison if kss == 'None':
Model bathymetry: 55.0 Model bathymetry: 55.0
figmap, fig = ONC.compare_ONC_model(csvfilename, sdt, edt, grid_B['nowcast-green'],
result_homes['nowcast-green'],
period='1d', interp=True,smin=30, smax=33, tmin=8, tmax=12,
teos_to_psu=True)
/data/nsoontie/MEOPAR/analysis-nancy/notebooks/strat/comparisons/ONC.py:37: FutureWarning: convert_objects is deprecated. Use the data-type specific converters pd.to_datetime, pd.to_timedelta and pd.to_numeric. data = data.convert_objects(convert_numeric=True) /data/nsoontie/MEOPAR/analysis-nancy/notebooks/strat/comparisons/ONC.py:205: FutureWarning: how in .resample() is deprecated the new syntax is .resample(...).mean() data_r = data.resample(r, how='mean', base=0.5) /data/nsoontie/MEOPAR/tools/SalishSeaNowcast/nowcast/analyze.py:171: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison if kss == 'None':
Model bathymetry: 71.125 Model bathymetry: 71.125