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 %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,7) # Results dataset location results_home = '/ocean/sallen/allen/research/MEOPAR/SalishSea/forecast/' results_dir = os.path.join(results_home, run_date.strftime('%d%b%y').lower()) # model winds model_path='/ocean/sallen/allen/research/MEOPAR/Operational/fcst/' grid_T_hr = results_dataset('1h', 'grid_T', results_dir) bathy = nc.Dataset('/data/nsoontie/MEOPAR/NEMO-forcing/grid/bathy_meter_SalishSea2.nc') HTML('

{:%d%b%y} Forecast Figures

'.format(run_date)) fig = figures.PA_tidal_predictions(grid_T_hr) fig = figures.compare_tidalpredictions_maxSSH(grid_T_hr, bathy, model_path, name='Victoria') fig = figures.compare_tidalpredictions_maxSSH(grid_T_hr, bathy, model_path) fig = figures.compare_tidalpredictions_maxSSH(grid_T_hr, bathy, model_path, name='Campbell River') fig = figures.compare_water_levels(grid_T_hr, bathy,PST=1) fig = figures.plot_thresholds_all(grid_T_hr, bathy, model_path) fig = figures.Sandheads_winds(grid_T_hr,bathy,model_path) reload(figures) fig = figures.average_winds_at_station(grid_T_hr, bathy, model_path, station = 'all') reload(figures) fig = figures.winds_at_max_ssh(grid_T_hr, bathy, model_path, station = 'all')