#!/usr/bin/env python # coding: utf-8 # Reasearch figures template # # SalishSeaCast NEMO model Daily Nowcast Figures - Tracers and Currents # # Set-up # In[1]: 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 get_ipython().run_line_magic('matplotlib', 'inline') # In[2]: 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]) # In[3]: run_date = datetime.datetime(2015,10,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()) # Load the results datasets: # In[4]: grid_T_dy = results_dataset('1d', 'grid_T', results_dir) grid_T_hr = results_dataset('1h', 'grid_T', results_dir) grid_U_dy = results_dataset('1d', 'grid_U', results_dir) grid_V_dy = results_dataset('1d', 'grid_V', results_dir) # In[5]: bathy = nc.Dataset('/data/nsoontie/MEOPAR/NEMO-forcing/grid/bathy_meter_SalishSea2.nc') mesh_mask = nc.Dataset('/data/nsoontie/MEOPAR/NEMO-forcing/grid//mesh_mask_SalishSea2.nc') # Display the figures: # In[6]: HTML('