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(2015,2,2) # 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') import scipy.io as sio PNW_coastline = sio.loadmat('/ocean/rich/more/mmapbase/bcgeo/PNW.mat') 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') reload(figures) fig = figures.compare_water_levels(grid_T_hr, bathy, PNW_coastline, PST=1) reload(figures) fig = figures.plot_thresholds_all(grid_T_hr, bathy, model_path, PNW_coastline) reload(figures) fig = figures.Sandheads_winds(grid_T_hr,bathy,model_path, PNW_coastline) reload(figures) fig = figures.average_winds_at_station(grid_T_hr, bathy, model_path, PNW_coastline, station = 'all') reload(figures) fig = figures.winds_average_max(grid_T_hr, bathy, model_path, PNW_coastline, station = 'all', wind_type = 'average') reload(figures) fig = figures.winds_at_max_ssh(grid_T_hr, bathy, model_path, PNW_coastline, station = 'all') reload(figures) fig = figures.winds_average_max(grid_T_hr, bathy, model_path, PNW_coastline, station = 'all', wind_type = 'max') reload(figures) fig = figures.plot_threshold_website(bathy, grid_T_hr, model_path, PNW_coastline) reload(figures) fig = figures.website_thumbnail(bathy, grid_T_hr, model_path, PNW_coastline)