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('