{ "cells": [ { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "# IMOS historical wave data" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ ":::{important}\n", "Access to historical records is important to \n", "* evaluate global and local impacts of climate change & anthropogenic influences and \n", "* test and validate models. In the modelling area, this kind of approach is done routinely to evaluate models performances (hindcast models).\n", ":::\n", "\n", "Here we will see how we can query historical data from a buoy located offshore Sydney. \n", "\n", "\n", "```{figure} ../_static/mhl.png\n", "---\n", "figclass: margin\n", "name: margin_figure24\n", "---\n", "```\n", "\n", "Our dataset is available from: \n", "\n", "+ [IMOS Data Portal](http://imos.org.au) and has been recorded by the [**Manly Hydraulics Laboratory**](https://mhl.nsw.gov.au):\n", "+ [dataset link](http://imos-data.s3-website-ap-southeast-2.amazonaws.com/?prefix=NSW-OEH/Manly_Hydraulics_Laboratory/Wave/Sydney/)\n", "\n", "We will use the **netCDF** libary ([Network Common Data Form](http://www.unidata.ucar.edu/netcdf/)).\n", "\n", "As we saw in previous examples, this library is a set of self-describing, machine-independent data formats that support the creation, access, and sharing of array-oriented scientific data. The project homepage is hosted by the **Unidata** program at the University Corporation for Atmospheric Research (**UCAR**).\n", "\n", "Loading a module is straight forward:" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "from pylab import *\n", "import netCDF4\n", "import datetime as dt\n", "import numpy as np\n", "import pandas as pd\n", "import cftime\n", "\n", "import matplotlib.pyplot as plt\n", "import warnings\n", "warnings.filterwarnings('ignore')\n", "\n", "%config InlineBackend.figure_format = 'svg'\n", "plt.rcParams['mathtext.fontset'] = 'cm'" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## 2015 Waverider Buoy dataset\n", "\n", "We will use a dataset containing ocean wave data from wave monitoring buoy moored off Sydney at latitude 33$^o$46'26\" S, longitude 151$^o$24'42\" E and water depth 90 metres. \n", "\n", " Sydney Waverider Buoy location history\n", "\n", "\n", ":::{admonition} Where is the data coming from?\n", ":class: toggle, note\n", "\n", "The data is gathered using the Directional Waverider system developed by the Dutch company, Datawell. \n", "\n", "The Directional Waverider buoy utilises a heave-pitch-roll sensor, two fixed X and Y accelerometers and a three axis fluxgate compass to measure both vertical and horizontal motion. \n", "\n", "An on-board processor converts the buoy motion to three orthogonal (vertical, north-south, east-west) translation signals that are transmitted to the shore station. The directional spectrum is also routinely transmitted to the receiving station for further processing. \n", "\n", "The wave data is stored on the receiving station PC before routine transfer to *Manly Hydraulics Laboratory*.\n", "\n", ":::" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "# Offshore Sydney buoy data\n", "url_sydney = 'http://thredds.aodn.org.au/thredds/dodsC/NSW-OEH/Manly_Hydraulics_Laboratory/Wave/Sydney/IMOS_ANMN-NSW_W_20150210T230000Z_WAVESYD_WAVERIDER_FV01_END-20171231T130000Z.nc'\n", " \n", "# Offshore Batemans Bay buoy data\n", "#url_batemans = 'http://thredds.aodn.org.au/thredds/dodsC/NSW-OEH/Manly_Hydraulics_Laboratory/Wave/Batemans_Bay/IMOS_ANMN-NSW_W_20080124T210000Z_WAVEBAB_WAVERIDER_FV01_END-20151231T130000Z.nc'\n", "\n", "# Offshore Byron Bay buoy data\n", "#url_byron = 'http://thredds.aodn.org.au/thredds/dodsC/NSW-OEH/Manly_Hydraulics_Laboratory/Wave/Byron_Bay/IMOS_ANMN-NSW_W_20140529T010000Z_WAVEBYB_WAVERIDER_FV01_END-20171231T130000Z.nc'\n", "\n", "nc_data=netCDF4.Dataset(url_sydney)\n" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Query dataset\n", "\n", "Let have a look at the loaded netCDF variables" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "odict_keys(['TIME', 'TIMESERIES', 'LATITUDE', 'LONGITUDE', 'WHTH', 'WMSH', 'HRMS', 'WHTE', 'WMXH', 'TCREST', 'WPMH', 'WPTH', 'YRMS', 'WPPE', 'TP2', 'M0', 'WPDI'])" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "nc_data.variables.keys()" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "\n", "float64 TIME(TIME)\n", " long_name: time\n", " standard_name: time\n", " units: days since 1950-01-01 00:00:00 UTC\n", " calendar: gregorian\n", " valid_max: 999999.0\n", " axis: T\n", " valid_min: 0.0\n", "unlimited dimensions: \n", "current shape = (23382,)\n", "filling off\n" ] } ], "source": [ "print(nc_data.variables['TIME'])" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "## Find out time interval record\n", "\n", "Get the time extension of the gathered data..." ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "units = nc_data.variables['TIME'].units\n", "calendar = nc_data.variables['TIME'].calendar\n", "\n", "times = netCDF4.num2date(nc_data.variables['TIME'][:], units=units, calendar=calendar)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "buoy record start time: 2015-Feb-10 23:00\n" ] } ], "source": [ "start = dt.datetime(1985,1,1)\n", "# Get desired time step \n", "time_var = nc_data.variables['TIME']\n", "itime = netCDF4.date2index(start,time_var,select='nearest')\n", "dtime = netCDF4.num2date(time_var[itime],time_var.units)\n", "daystr = dtime.strftime('%Y-%b-%d %H:%M')\n", "\n", "print('buoy record start time:',daystr)" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "buoy record end time: 2017-Dec-31 13:00\n" ] } ], "source": [ "end = dt.datetime(2018,1,1)\n", "# Get desired time step \n", "time_var = nc_data.variables['TIME']\n", "itime2 = netCDF4.date2index(end,time_var,select='nearest')\n", "dtime2 = netCDF4.num2date(time_var[itime2],time_var.units)\n", "dayend = dtime2.strftime('%Y-%b-%d %H:%M')\n", "\n", "print('buoy record end time:',dayend)" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Records per day:\n", "2015-02-11 00:00:00\n", "2015-02-11 01:00:00\n", "2015-02-11 02:00:00\n", "2015-02-11 03:00:00\n", "2015-02-11 04:00:00\n", "2015-02-11 05:00:00\n", "2015-02-11 06:00:00\n", "2015-02-11 07:00:00\n", "2015-02-11 08:00:00\n", "2015-02-11 09:00:00\n", "2015-02-11 10:00:00\n", "2015-02-11 11:00:00\n", "2015-02-11 12:00:00\n", "2015-02-11 13:00:00\n", "2015-02-11 14:00:00\n", "2015-02-11 15:00:00\n", "2015-02-11 16:00:00\n", "2015-02-11 17:00:00\n", "2015-02-11 18:00:00\n", "2015-02-11 19:00:00\n", "2015-02-11 20:00:00\n", "2015-02-11 21:00:00\n", "2015-02-11 22:00:00\n", "2015-02-11 23:00:00\n" ] } ], "source": [ "print('Records per day:')\n", "for k in range(1,25):\n", " print(netCDF4.num2date(time_var[k],time_var.units))" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "subslide" } }, "source": [ "## Buoy location\n", "\n", "Check the location of the data" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "151.41167 -33.77389\n" ] } ], "source": [ "loni = nc_data.variables['LONGITUDE'][:]\n", "lati = nc_data.variables['LATITUDE'][:]\n", "print(loni,lati)\n", "names=[]\n", "names.append('Offshore Sydney Buoy')" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Visualise buoy records\n", "\n", "Export for the historical time serie, the desired buoy variables, here we use HRMS:" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [], "source": [ "times = nc_data.variables['TIME']\n", "jd_data = netCDF4.num2date(times[:],times.units, only_use_cftime_datetimes=False, \n", " only_use_python_datetimes=True).flatten()\n", "hm_data = nc_data.variables['HRMS'][:].flatten()\n", "#T_data = ???" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now plot the exported dataset" ] }, { "cell_type": "code", "execution_count": 19, "metadata": { "tags": [] }, "outputs": [ { "data": { "image/svg+xml": [ "\n", "\n", "\n", "\n", " \n", " \n", " \n", " \n", " 2021-03-24T11:50:47.575855\n", " image/svg+xml\n", " \n", " \n", " Matplotlib v3.3.4, https://matplotlib.org/\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "\n" ], "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "MyDateFormatter = DateFormatter('%Y-%b-%d')\n", "fig = plt.figure(figsize=(12,4)) \n", "ax1 = fig.add_subplot(111)\n", "\n", "ax1.plot(jd_data[itime:itime2], hm_data[itime:itime2], linewidth=1, color='blue') \n", "\n", "ax1.xaxis.set_major_locator(WeekdayLocator(byweekday=MO,interval=12))\n", "ax1.xaxis.set_major_formatter(MyDateFormatter)\n", "ax1.grid(True)\n", "\n", "setp(gca().get_xticklabels(), rotation=45, horizontalalignment='right')\n", "plt.title('IMOS Offshore Sydney Buoy Data since 2015')\n", "ax1.set_ylabel('meters')\n", "ax1.legend(names,loc='upper right')\n", "\n", "fig.show()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## April 2015 storm\n", "\n", "````{margin}\n", "```{seealso}\n", "SMH: [Storm of the century batters Sydney and the Hunter, leaving three dead and homes destroyed](https://www.smh.com.au/environment/weather/storm-of-the-century-batters-sydney-and-the-hunter-leaving-three-dead-and-homes-destroyed-20150421-1mq76b.html)\n", "```\n", "````\n", "\n", "\n", "```{eval-rst}\n", ".. figure:: https://i.guim.co.uk/img/media/643dfa81d4bbca129906d8a26c683e3e6901c053/0_110_3000_1801/3000.jpg?w=1010&q=55&auto=format&usm=12&fit=max&s=6dac931858af8c21404a5604900ae71d\n", " :width: 80 %\n", " :alt: A man fools around in the wind at Bondi Beach, Sydney, on April 21 2015.\n", " :align: center\n", "\n", " Turquoise Bay\n", "```\n", "\n", "To find the temporal `id` of the storm we use the python function `argmax`:" ] }, { "cell_type": "code", "execution_count": 18, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Temporal ID of the strom: 1595\n", "Corresponding date: 2015-04-21 06:00:00\n" ] } ], "source": [ "idmax = hm_data[itime:itime2].argmax()\n", "print('Temporal ID of the strom:',idmax)\n", "print('Corresponding date:',jd_data[idmax])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Plotting variables \n", "\n", "Set the wave height RMS 48h before and after the recorded maximum wave height RMS time." ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "tags": [ "hide-output" ] }, "outputs": [ { "ename": "SyntaxError", "evalue": "invalid syntax (, line 1)", "output_type": "error", "traceback": [ "\u001b[0;36m File \u001b[0;32m\"\"\u001b[0;36m, line \u001b[0;32m1\u001b[0m\n\u001b[0;31m storm_time = ???\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n" ] } ], "source": [ "storm_time = ???\n", "storm_hrms = ???\n", "storm_period = ???" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "tags": [ "hide-output" ] }, "outputs": [ { "ename": "NameError", "evalue": "name 'storm_time' is not defined", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 3\u001b[0m \u001b[0max1\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mfig\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0madd_subplot\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m111\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 4\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 5\u001b[0;31m \u001b[0max1\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mplot\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mstorm_time\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mstorm_hrms\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0mlinewidth\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m4\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 6\u001b[0m \u001b[0max1\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mxaxis\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mset_major_locator\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mHourLocator\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mbyhour\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mrange\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m24\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0minterval\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m6\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0max1\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mxaxis\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mset_major_formatter\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mMyDateFormatter\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mNameError\u001b[0m: name 'storm_time' is not defined" ] }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAp4AAAKBCAYAAAD+9qvdAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjMuNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8QVMy6AAAACXBIWXMAAAxOAAAMTgF/d4wjAAAXDElEQVR4nO3df6jl913n8dd7m9KgY4qIMdibOJGkq6ktGmrZhdaq/UP/MUtN/zAStkJYx/61kH+26KILJS6kSxAxYEICVSOIa1BSEYV1I1oTDGJif4mpDZPJnVTTBaU7f5Tu0M/+ce/IOM4k586ceU1u5vGAC/mefM7Je/jkHp58v+fMd9ZaAQCAy+3fXOkBAAC4OghPAAAqhCcAABXCEwCACuEJAECF8AQAoEJ4AgBQsVF4zswvz8zxmVkz8z2vsu6emfnCzHxxZh6emWu2NyoAAIfZpmc8fyfJe5O8eKEFM3Nzko/tr7slyQ1J7rnUAQEAeGPYKDzXWn+61tp9jWUfSvK7a61/WHu3Q/rVJHdd6oAAALwxbPNS+E35l2dEj+8/dl4zc2+Se88cv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64xephtcl+n3FfkqcrU3G5bPJ+/g1Jfi/Jf11rfXeSdyT5s+aQbM0mv993JPmBJN+71npXkj9O8ou9Edmi38leh714oQWX0muV8HSv96vLpvu91np2/6/gylrrq0meS/KdvUnZhgP8fmdm3pfk1iS/URuQrTrAfv9kkqfXWp9KkrXW6bXWl2uDshUH+f1O8pYk1+5fubouySXd4YYrY631p2ut19q7i+611hnPf3Wv9+zd0ejc+7hvfK93Xtc23e9/NjM3ZO9/5D+oTMg2bbTfM/ONSX4pyUfaA7JVm/5+35bkqzPz+zPz3Mz8+sx8a3lWLt2m+/3JJE8m+fskX0rygSQ/X5yTrovuteal9q3e653XvU33OzNzXfbetO5fa/3VZZ2Ky2WT/f54kgfXWicL83B5bbLfb07yI9m7+cj3Ze/Wyw9e5rm4PDbZ79uTfFeStyX59uxdav+VyzwXV9ZF9VorPN3r/eqy6X5nZr4pyR8meWKt5e4Xh9Om+/3eJD8/M8ezdyvdd87M55qDshWb7veLSZ5ca53cP0v2m0neU52Ubdh0v38qe/v9T2utryf5tSQ/1ByUqovutUp4utf71WXT/Z6ZI9mLzj9aa32sOiRbs+l+r7XetdY6utY6muQnknxmrfWO5qxcugO8n/92ku/fv6KRJD+a5K8rQ7I1B9jvF5J8YGbevH/8Y0k+WxmSK+Gie612y8yZ+bdJPpHkW5J8JcmH11qfm5lHsne264n9df8pyX/JXhT/7yQfWWv9v8qQbM0m+z0zP5fkvyU5+6zX/1xr3deel0uz6e/3Wet/MMn/WGu9uzwqW3CA9/P/mL3389NJTib56Q2+tMDrzIbv52/J3qX19yX5WvY+53nsPIHK69zMPJjkP2Tvm+r/J8mptdYt2+o192oHAKDCnYsAAKgQngAAVAhPAAAqhCcAABXCEwCACuEJAECF8AQAoEJ4AgBQ8f8B3Sou61aQjRMAAAAASUVORK5CYII=\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "MyDateFormatter = DateFormatter('%b-%d %H:%M')\n", "fig = plt.figure(figsize=(10,10), dpi=80) \n", "ax1 = fig.add_subplot(111)\n", "\n", "ax1.plot(storm_time,storm_hrms,linewidth=4) \n", "ax1.xaxis.set_major_locator(HourLocator(byhour=range(24),interval=6))\n", "ax1.xaxis.set_major_formatter(MyDateFormatter)\n", "ax1.grid(True)\n", "setp(gca().get_xticklabels(), rotation=45, horizontalalignment='right')\n", "plt.title('Offshore Sydney Buoy Data for April 2015 storm')\n", "ax1.set_ylabel('meters')\n", "names = ['HRMS']\n", "ax1.legend(names,loc='upper right')" ] }, { "cell_type": "markdown", "metadata": { "slideshow": { "slide_type": "slide" } }, "source": [ "## Wave power and energy\n", "\n", "- Wave power:\n", "\n", "$$\n", "P = \\frac{\\rho g^2}{64 \\pi} H_{mo}^2 T \\simeq 0.5 H_{mo}^2 T\n", "$$\n", "\n", "- Wave energy:\n", "\n", "$$\n", "E = \\frac{1}{16}\\rho g H_{mo}^2\n", "$$\n", "\n", ":::{note}\n", "You can define $\\pi$ using `np.pi`.\n", ":::\n", "\n", "### Define the functions" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "hide-output" ] }, "outputs": [], "source": [ "def wave_power(rho,g,h,t):\n", " power = ???\n", " return power\n", "\n", "def wave_energy(rho,g,h):\n", " energy = ???\n", " return energy" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "hide-output" ] }, "outputs": [], "source": [ "storm_power = wave_power(???)\n", "storm_energy = wave_energy(???)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Plot the data over the storm duration" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "tags": [ "hide-output" ] }, "outputs": [], "source": [ "MyDateFormatter = DateFormatter('%b-%d %H:%M')\n", "fig = plt.figure(figsize=(10,10), dpi=80) \n", "ax1 = fig.add_subplot(111)\n", "\n", "ax1.plot(???,???,linewidth=4) \n", "ax1.xaxis.set_major_locator(HourLocator(byhour=range(24),interval=6))\n", "ax1.xaxis.set_major_formatter(MyDateFormatter)\n", "ax1.grid(True)\n", "setp(gca().get_xticklabels(), rotation=45, horizontalalignment='right')\n", "plt.title('Offshore Sydney Buoy Data for April 2015 storm')\n", "ax1.set_ylabel('meters')\n", "names = ['HRMS']\n", "ax1.legend(names,loc='upper right')" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "celltoolbar": "Tags", "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.13" } }, "nbformat": 4, "nbformat_minor": 4 }