{ "metadata": { "name": "FVCOM_depth_and_velocity" }, "nbformat": 3, "nbformat_minor": 0, "worksheets": [ { "cells": [ { "cell_type": "code", "collapsed": false, "input": [ "from IPython.core.display import HTML\n", "\n", "with open('creative_commons.txt', 'r') as f:\n", " html = f.read()\n", " \n", "with open('./styles/custom.css', 'r') as f:\n", " styles = f.read()\n", " \n", "HTML(styles)\n", "\n", "# name of file\n", "name = 'FVCOM_depth_and_velocity'\n", "\n", "html = \"\"\"\n", "\n", "
This post was written as an IPython notebook. It is available for download or as a static html.
\n", "\n", "%s \"\"\" % (name, name, html)" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 1 }, { "cell_type": "heading", "level": 1, "metadata": {}, "source": [ "Access data from the NECOFS (New England Coastal Ocean Forecast System) via OPeNDAP" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Demonstration using the NetCDF4-Python library to access velocity data from a triangular grid ocean model (FVCOM) via OPeNDAP, specifying the desired URL, time, layer and lat/lon region of interest. The resulting plot of forecast velocity vectors over color-shaded bathymetry is useful for a variety of recreational and scientific purposes. \n", "\n", "NECOFS (Northeastern Coastal Ocean Forecast System) is run by groups at the University of Massachusetts Dartmouth and the Woods Hole Oceanographic Institution, led by Drs. C. Chen, R. C. Beardsley, G. Cowles and B. Rothschild. Funding is provided to run the model by the NOAA-led Integrated Ocean Observing System and the State of Massachusetts.\n", "\n", "NECOFS is a coupled numerical model that uses nested weather models, a coastal ocean circulation model, and a wave model. The ocean model is a volume-mesh model with horizontal resolution that is finer in complicated regions. It is layered (not depth-averaged) and includes the effects of tides, winds, and varying water densities caused by temperature and salinity changes.\n", "\n", "* Model description: http://fvcom.smast.umassd.edu/research_projects/NECOFS/model_system.html\n", "* THREDDS server with other forecast and archive products: http://www.smast.umassd.edu:8080/thredds/catalog.html" ] }, { "cell_type": "code", "collapsed": false, "input": [ "from pylab import *\n", "import matplotlib.tri as Tri\n", "import netCDF4\n", "import datetime as dt" ], "language": "python", "metadata": {}, "outputs": [], "prompt_number": 2 }, { "cell_type": "code", "collapsed": false, "input": [ "# DAP Data URL\n", "# MassBay GRID\n", "url = 'http://www.smast.umassd.edu:8080/thredds/dodsC/FVCOM/NECOFS/Forecasts/NECOFS_FVCOM_OCEAN_MASSBAY_FORECAST.nc'\n", "# GOM3 GRID\n", "#url='http://www.smast.umassd.edu:8080/thredds/dodsC/FVCOM/NECOFS/Forecasts/NECOFS_GOM3_FORECAST.nc'\n", "# Open DAP\n", "nc = netCDF4.Dataset(url).variables\n", "nc.keys()" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "pyout", "prompt_number": 3, "text": [ "[u'x',\n", " u'y',\n", " u'lon',\n", " u'lat',\n", " u'xc',\n", " u'yc',\n", " u'lonc',\n", " u'latc',\n", " u'siglay',\n", " u'h',\n", " u'nv',\n", " u'time',\n", " u'Times',\n", " u'zeta',\n", " u'nbe',\n", " u'aw0',\n", " u'awx',\n", " u'awy',\n", " u'u',\n", " u'v',\n", " u'ww',\n", " u'ua',\n", " u'va',\n", " u'temp',\n", " u'salinity',\n", " u'fvcom_mesh']" ] } ], "prompt_number": 3 }, { "cell_type": "code", "collapsed": false, "input": [ "# take a look at the \"metadata\" for the variable \"u\"\n", "print nc['u']" ], "language": "python", "metadata": {}, "outputs": [ { "output_type": "stream", "stream": "stdout", "text": [ "This post was written as an IPython notebook. It is available for download or as a static html.
\n", "\n", "