diff --git a/notebooks/geoclaw/Tide_Module_Examples.ipynb b/notebooks/geoclaw/Tide_Module_Examples.ipynb
new file mode 100644
index 0000000..04bf986
--- /dev/null
+++ b/notebooks/geoclaw/Tide_Module_Examples.ipynb
@@ -0,0 +1,496 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "id": "070f5263",
+ "metadata": {
+ "scrolled": false
+ },
+ "source": [
+ "## Tide Prediction Module Functions"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "proper-patch",
+ "metadata": {},
+ "source": [
+ " - retrieve_constituents - retrieves harmonic constituents from NOAA gauge station\n",
+ " - fetch_noaa_tide_data()
- retrieves datetimes, water levels and tide predictions at given NOAA tide station from NOAA's API\n",
+ " \n",
+ " - datetimes - prepares a collection of datetimes from beginning to end dates if needed\n",
+ " \n",
+ " - predict_tide()
- predicts tide for desired NOAA station given station ID, start date and end date for prediction \n",
+ " - datum_value - retrieves datum value for desired datum reference, utilized by predict_tide to obtain MTL value\n",
+ " - detide()
- detides observed water levels with predicted tide\n",
+ " - surge()
- predicts surge at NOAA gauge station provided station ID, start date, end date, and landfall date, best for a Clawpack Simulation!"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "noticed-delhi",
+ "metadata": {},
+ "source": [
+ "# Example of Tide Prediction For One Date Instance\n",
+ "\n",
+ "- In this example, method used to predict tide is adapated from Pytides\n",
+ "- This implementation will only work for known NOAA gauge stations\n",
+ "- Harmonic Constituents data is scraped from NOAA. "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "f1656e3a",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import matplotlib.pyplot as plt\n",
+ "import datetime\n",
+ "import clawpack.geoclaw.tide as tide\n",
+ "\n",
+ "#%env CLAW="
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "1cd0bf32",
+ "metadata": {},
+ "source": [
+ "### **** Station Information ****"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "33307057",
+ "metadata": {},
+ "source": [
+ "Locate NOAA station ID. NOAA gauge stations home: https://tidesandcurrents.noaa.gov/
\n",
+ "Fill in station ID, reference datum and date instance for tide prediction!"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "3c76d8a9",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "#Station Information\n",
+ "station_id = '8761724'\n",
+ "datum = 'MTL'\n",
+ "\n",
+ "#Date of prediction (YEAR, MTH, DAY, HR)\n",
+ "prediction_date = datetime.datetime(2005, 8, 29, 11)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "444bf7f2",
+ "metadata": {},
+ "source": [
+ "### Tide Prediction"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "67132515",
+ "metadata": {},
+ "source": [
+ "Prediction of tide at specified location (station ID) and specified time (GMT) implemented below by calling predict_tide()
method with the following arguments: station_id, beg_prediction_date, end_prediction_date. Note: datum argument is optional\n",
+ "\n",
+ "
\n",
+ "\n",
+ "To predict tide at an instant, set beg_prediction_date and end_prediction_date in predict_tide()
method to the same date!"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "fa3eebea",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "#NOAA Data Scraping Implementation \n",
+ "height = tide.predict_tide(station_id, prediction_date, prediction_date, datum='MTL')\n",
+ "times = tide.datetimes(prediction_date, prediction_date) # in meters\n",
+ "print(height[0], \"meters\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "e775a8ff",
+ "metadata": {},
+ "source": [
+ "*******************************************************************************************************************"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "d4be333b",
+ "metadata": {},
+ "source": [
+ "# Example of Tide Prediction In A Date Interval "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "f64a6167",
+ "metadata": {},
+ "source": [
+ "### Station Information "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "b2b2c5c8",
+ "metadata": {},
+ "source": [
+ "Fill in station ID, a beginning date and an end date for tide prediction below"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "6af4f3b1",
+ "metadata": {
+ "scrolled": false
+ },
+ "outputs": [],
+ "source": [
+ "#Station Information\n",
+ "station_id = '8761724'\n",
+ "datum = 'MTL'\n",
+ "\n",
+ "#Beginning and End Dates \n",
+ "beg_date = datetime.datetime(2005, 8, 26, hour=0)\n",
+ "end_date = datetime.datetime(2005, 8, 31, hour=0)\n",
+ "\n",
+ "#Predict tide with arguments set as: (station_id, beg_prediction_date, end_prediction_date)\n",
+ "predicted_tide = tide.predict_tide(station_id, beg_date, end_date, datum='MTL')"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "5fdc6fa2",
+ "metadata": {},
+ "source": [
+ "### Tide Predictions\n",
+ "Plot results in a time series plot"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "b07d1fa6",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "#Method datetimes() makes a range of datetimes given arguments: (beg_prediction_date, end_prediction_date)\n",
+ "times = tide.datetimes(beg_date, end_date)\n",
+ "\n",
+ "plt.figure(figsize=(20,10))\n",
+ "plt.plot(times, predicted_tide, \"-\", label=\"Tide Prediction\")\n",
+ "plt.xlabel('Hours since ' + str(beg_date) + ' (GMT)')\n",
+ "plt.ylabel('Meters'), plt.margins(x=0), plt.legend(loc = 'best')\n",
+ "plt.title('My Prediction for Station {}'.format(station_id))\n",
+ "plt.show()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "6e68cdb9",
+ "metadata": {},
+ "source": [
+ "*******************************************************************************************************************"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "1d65a5a1",
+ "metadata": {},
+ "source": [
+ "# Example Comparing NOAA vs Our Tide Prediction In A Date Interval "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "bb42cecd",
+ "metadata": {
+ "scrolled": false
+ },
+ "outputs": [],
+ "source": [
+ "#Station Information\n",
+ "station_id = '8761724'\n",
+ "datum = 'MTL'\n",
+ "\n",
+ "#Beginning and End Dates \n",
+ "beg_date = datetime.datetime(2005, 8, 26)\n",
+ "end_date = datetime.datetime(2005, 8, 31)\n",
+ "\n",
+ "#Predict Tide \n",
+ "predicted_tide = tide.predict_tide(station_id, beg_date, end_date, datum='MTL')"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "0bcba7b5",
+ "metadata": {},
+ "source": [
+ "- Calling function fetch_noaa_tide_data()
with arguments set as (station_id, beg_prediction_date, end_prediction_date) retrieves datetimes, water levels and tide predictions for the specified NOAA station in the date interval provided from NOAA's API\n",
+ "- Data is scraped in Metric units, GMT timezone, MTL datum and 6 min intervals. These arguments are optional in fetch_noaa_tide_data()
."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "558239c0",
+ "metadata": {
+ "scrolled": false
+ },
+ "outputs": [],
+ "source": [
+ "#Retrieve NOAA Tide Data\n",
+ "times, NOAA_observed_water_lvl, NOAA_predicted_tide = tide.fetch_noaa_tide_data(station_id, beg_date, end_date, datum='MTL')"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "c91f7d0d",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "#Plot Comparisons\n",
+ "plt.figure(figsize=(20,10))\n",
+ "plt.plot(times, predicted_tide, \"-\", label=\"Our Tide Prediction\")\n",
+ "plt.plot(times, NOAA_predicted_tide, \"-\", label=\"NOAA Tide Prediction\")\n",
+ "plt.plot(times, NOAA_observed_water_lvl, \"-\", label=\"NOAA Water Level Observation\")\n",
+ "plt.xlabel('Hours since ' + str(beg_date) + ' (GMT)')\n",
+ "plt.ylabel('Metres'), plt.margins(x=0), plt.legend(loc = 'best')\n",
+ "plt.title('Comparison of Our Prediction vs NOAA prediction for Station {}'.format(station_id))\n",
+ "plt.show()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "edabf72c",
+ "metadata": {},
+ "source": [
+ "*******************************************************************************************************************"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "25f9fca1",
+ "metadata": {},
+ "source": [
+ "# Example Detiding and Capturing A Surge for a Gauge Station "
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "ff60fcac",
+ "metadata": {},
+ "source": [
+ "- Calling predict_tide()
method with arguments set as: (station_id, beg_prediction_date, end_prediction_date) outputs predicted tide\n",
+ "- Calling fetch_noaa_tide_data()
with arguments set as (station_id, beg_prediction_date, end_prediction_date) retrieves datetimes, water levels and tide predictions from NOAA\n",
+ "- Calling detide()
method with arguments set as: (NOAA observed water level, predicted tide) will output detided water level. "
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "2e12ce1c",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "#Station Information\n",
+ "station_id = '8761724'\n",
+ "datum = 'MTL'\n",
+ "\n",
+ "#Beginning and End Dates \n",
+ "beg_date = datetime.datetime(2005, 8, 26)\n",
+ "end_date = datetime.datetime(2005, 8, 31)\n",
+ "\n",
+ "predicted_tide = tide.predict_tide(station_id, beg_date, end_date)\n",
+ "times, NOAA_observed_water_lvl, NOAA_predicted_tide = tide.fetch_noaa_tide_data(station_id, beg_date, end_date, datum='MTL')\n",
+ "\n",
+ "surge = tide.detide(NOAA_observed_water_lvl, predicted_tide)\n",
+ "\n",
+ "#Plot Comparisons\n",
+ "plt.figure(figsize=(20,10))\n",
+ "plt.plot(times, surge, \"-\", label=\"Our Surge Prediction\")\n",
+ "plt.xlabel('Hours since ' + str(beg_date) + ' (GMT)')\n",
+ "plt.ylabel('Metres'), plt.margins(x=0), plt.legend(loc = 'best')\n",
+ "plt.title('Detided Water Level for Station {}'.format(station_id))\n",
+ "plt.show()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "5361dc29",
+ "metadata": {},
+ "source": [
+ "*******************************************************************************************************************"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "48fd6775",
+ "metadata": {},
+ "source": [
+ "# Example for Clawpack Storm Surge Implementation"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "44b5db31",
+ "metadata": {},
+ "source": [
+ "- Code below works best if placed in gauge_afteraxes( ) in setplot.py for a storm simulation.\n",
+ "- Calling surge()
method with arguments set as: (station_id, beginning_date, end_date, landfall_date) will output storm surge from NOAA observed water levels and predicted tide."
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "15e31fba",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import clawpack.geoclaw.tide as tide\n",
+ "import datetime"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "1483072e",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "#Station Information\n",
+ "station_id = '8761724'\n",
+ "\n",
+ "#Beginning, End, Landfall Dates\n",
+ "beg_date = datetime.datetime(2005, 8, 26)\n",
+ "end_date = datetime.datetime(2005, 8, 31)\n",
+ "landfall_date = datetime.datetime(2005, 8, 29, 11, 10)\n",
+ "\n",
+ "# Surge Prediction\n",
+ "times, surge = tide.surge(station_id, beg_date, end_date, landfall_date)\n",
+ "plt.plot(times, surge, color=\"b\", label=\"Our Prediction\")"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "d364a6c2",
+ "metadata": {},
+ "source": [
+ "*******************************************************************************************************************"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "b5b0d89f",
+ "metadata": {},
+ "source": [
+ "# Example Iterating Through A Library Of Stations And Date Intervals"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "b3cdcd65",
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import clawpack.geoclaw.tide as tide\n",
+ "import datetime"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "id": "d26bd732",
+ "metadata": {
+ "scrolled": false
+ },
+ "outputs": [],
+ "source": [
+ "station_dict = {'8761724': ('Grand Isle, LA', (2005, 8, 26), (2005, 8, 31), (2005, 8, 29, 11, 10)), #katrina\n",
+ " '8760922': ('Pilots Station East, SW Pass, LA', (2005, 8, 26), (2005, 8, 31), (2005, 8, 29, 11)), #michael\n",
+ " '8658120': ('Wilmington, NC', (2016, 10, 6, 12), (2016, 10, 9, 12), (2016, 10, 8, 12)), #matthew\n",
+ " '8721604': ('Trident Pier, Port Canaveral, FL', (2019, 8, 24), (2019, 9, 9), (2019, 9, 4, 12)), #dorian\n",
+ " '8723970': ('Vaca Key, Florida Bay, FL', (2017, 9, 6, 13), (2017, 9, 12, 13), (2017, 9, 10, 13)) #irma\n",
+ " }\n",
+ "\n",
+ "for (key, value) in station_dict.items():\n",
+ " station_id = key\n",
+ " station_name = value[0]\n",
+ " beg_date = datetime.datetime(*value[1])\n",
+ " end_date = datetime.datetime(*value[2])\n",
+ " landfall_date = datetime.datetime(*value[3])\n",
+ " \n",
+ " #NOAA Data Scraping Implementation\n",
+ " predicted_tide = tide.predict_tide(station_id, beg_date, end_date) \n",
+ " \n",
+ " times, NOAA_observed_water_lvl, NOAA_predicted_tide = tide.fetch_noaa_tide_data(station_id, beg_date, end_date, datum='MTL')\n",
+ "\n",
+ " #Detide Water Level\n",
+ " surge = tide.detide(NOAA_observed_water_lvl, predicted_tide)\n",
+ " NOAA_surge = tide.detide(NOAA_observed_water_lvl, NOAA_predicted_tide)\n",
+ " \n",
+ " #Plot Comparisons\n",
+ " plt.figure(figsize=(20,10))\n",
+ " plt.plot(times, predicted_tide, \"-\", label=\"Our Tide Prediction\")\n",
+ " plt.plot(times, NOAA_predicted_tide, \"-\", label=\"NOAA Tide Prediction\")\n",
+ " plt.plot(times, NOAA_observed_water_lvl, \"-\", label=\"NOAA Water Level Observation\")\n",
+ " plt.xlabel('Hours since ' + str(beg_date) + ' (GMT)')\n",
+ " plt.ylabel('Metres'), plt.margins(x=0), plt.legend(loc = 'best')\n",
+ " plt.title('Comparison of Our Prediction vs NOAA prediction for Station {}, {}'.format(station_id, station_name))\n",
+ " plt.show()\n",
+ " \n",
+ " #Detided Water Level Comparison\n",
+ " plt.figure(figsize=(20,10))\n",
+ " plt.plot(times, surge, \"-\", label=\"Our Detided Prediction\")\n",
+ " plt.plot(times, NOAA_surge, \"-\", label=\"NOAA's Detided Prediction\")\n",
+ " plt.xlabel('Hours since ' + str(beg_date) + ' (GMT)')\n",
+ " plt.ylabel('Metres'), plt.margins(x=0), plt.legend(loc = 'best')\n",
+ " plt.title('Detided Water Level Comparison of Our Prediction vs NOAA prediction for Station {}, {}'.format(station_id, station_name))\n",
+ " plt.show()\n",
+ " \n",
+ " \n",
+ " #### Clawpack Implementation (in setplot.py) ####\n",
+ " times, surge = tide.surge(station_id, beg_date, end_date, landfall_date)\n",
+ " plt.plot(times, surge, color=\"b\", label=\"Our Surge Prediction\")\n",
+ " \n",
+ " "
+ ]
+ }
+ ],
+ "metadata": {
+ "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.9.10"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 5
+}