Template notebook for creation of notebooks that show daily figures from most recent Salish Sea NEMO model real-time (nowcast) run.
This is an interim step toward fully automated web publication of analysis and monitoring figures from nowcast runs.
MEOPAR/nowcast/
directory tree in your EOAS public_html/
web space:$ mkdir -p $HOME/public_html/MEOPAR/nowcast
Set-up
and replace them with a nice Heading 1 title like:
Salish Sea NEMO Model Daily Nowcast Figures
.After the day's nowcast run has finished and the results have been downloaded:
18nov14Figures.ipynb
.nowcast.figures
,
add any necessary set-up code to load the results datasets that they require,
and add cells to produce their plots./home/dlatorne/public_html/MEOPAR/nowcast/index.html
file to add a line
to the top of the Daily Analysis and Monitoring Figures
section like:<li><a href="http://nbviewer.ipython.org/url/www.eoas.ubc.ca/~dlatorne/MEOPAR/nowcast/17nov14Figures.ipynb">17nov18</a></li>
replacing ~dlatorne
with your ocean
userid, and the date (2 places) with the day's date.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.date.today()
# 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:
grid_T_hr = results_dataset('1h', 'grid_T', results_dir)
Display the figures:
HTML('<h2>{:%d%b%y} Figures</h2>'.format(run_date))
fig = figures.ssh_PtAtkinson(grid_T_hr)