from __future__ import division
import datetime
from glob import glob
import os
from IPython.core.display import HTML
import netCDF4 as nc
from salishsea_tools.nowcast import figures
from salishsea_tools.nowcast import residuals
import scipy.io as sio
%matplotlib inline
def results_dataset(period, grid, results_dir):
"""Return the results dataset for period (e.g. 1h or 1d)
and grid (e.g. grid_T, grid_U) from results_dir.
"""
filename_pattern = 'SalishSea_{period}_*_{grid}.nc'
filepaths = glob(os.path.join(results_dir, filename_pattern.format(period=period, grid=grid)))
return nc.Dataset(filepaths[0])
run_date = datetime.datetime(2014,12,20)
# Results dataset location
results_home = '/data/dlatorne/MEOPAR/SalishSea/nowcast/'
results_dir = os.path.join(results_home, run_date.strftime('%d%b%y').lower())
# model winds
model_path = '/ocean/sallen/allen/research/MEOPAR/Operational/'
grid_T_hr = results_dataset('1h', 'grid_T', results_dir)
bathy = nc.Dataset('/data/nsoontie/MEOPAR/NEMO-forcing/grid/bathy_meter_SalishSea2.nc')
PNW_coastline = sio.loadmat('/ocean/rich/more/mmapbase/bcgeo/PNW.mat')
fig = figures.plot_threshold_website(bathy, grid_T_hr, model_path, PNW_coastline)
fig = figures.compare_tidalpredictions_maxSSH(grid_T_hr, bathy, model_path)
Questions:
fig = figures.average_winds_at_station(grid_T_hr, bathy, model_path, coastline, 'all')
Add:
fig = figures.PA_tidal_predictions(grid_T_hr)
fig = figures.plot_thresholds_all(grid_T_hr, bathy, model_path, coastline)
t_orig=datetime.datetime(2015,1,1)
t_final = datetime.datetime(2015,1,31)
fig = residuals.compare_errors('Point Atkinson', 'nowcast', t_orig, t_final, bathy)
fig = residuals.compare_errors('Point Atkinson', 'forecast', t_orig, t_final, bathy)
forecast simulation for 2015-01-18 00:00:00 did not occur forecast simulation for 2015-01-19 00:00:00 did not occur