{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "Reasearch figures template" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# SalishSeaCast NEMO model Daily Nowcast Figures - Tracers and Currents" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Set-up" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [], "source": [ "from __future__ import division\n", "\n", "import datetime\n", "from glob import glob\n", "import os\n", "\n", "from IPython.core.display import HTML\n", "import netCDF4 as nc\n", "\n", "from salishsea_tools.nowcast import figures\n", "\n", "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [], "source": [ "def results_dataset(period, grid, results_dir):\n", " \"\"\"Return the results dataset for period (e.g. 1h or 1d)\n", " and grid (e.g. grid_T, grid_U) from results_dir.\n", " \"\"\"\n", " filename_pattern = 'SalishSea_{period}_*_{grid}.nc'\n", " filepaths = glob(os.path.join(results_dir, filename_pattern.format(period=period, grid=grid)))\n", " return nc.Dataset(filepaths[0])" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [], "source": [ "run_date = datetime.datetime(2015,10,20)\n", "\n", "# Results dataset location\n", "results_home = '/data/dlatorne/MEOPAR/SalishSea/nowcast/'\n", "results_dir = os.path.join(results_home, run_date.strftime('%d%b%y').lower())" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Load the results datasets:" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [], "source": [ "grid_T_dy = results_dataset('1d', 'grid_T', results_dir)\n", "grid_T_hr = results_dataset('1h', 'grid_T', results_dir)\n", "grid_U_dy = results_dataset('1d', 'grid_U', results_dir)\n", "grid_V_dy = results_dataset('1d', 'grid_V', results_dir)" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [], "source": [ "bathy = nc.Dataset('/data/nsoontie/MEOPAR/NEMO-forcing/grid/bathy_meter_SalishSea2.nc')\n", "mesh_mask = nc.Dataset('/data/nsoontie/MEOPAR/NEMO-forcing/grid//mesh_mask_SalishSea2.nc')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Display the figures:" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "