You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nsw-2016-storm-impact/notebooks/02_collision_protection_vol...

1052 lines
47 KiB
Plaintext

{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Investigate \"collision protection volume\" concept"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-03T00:37:28.874517Z",
"start_time": "2018-12-03T00:37:28.528594Z"
}
},
"outputs": [],
"source": [
"%matplotlib inline\n",
"%reload_ext autoreload\n",
"%autoreload"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-03T00:37:30.229243Z",
"start_time": "2018-12-03T00:37:28.875519Z"
}
},
"outputs": [],
"source": [
"from IPython.core.debugger import set_trace\n",
"\n",
"import pandas as pd\n",
"import numpy as np\n",
"import os\n",
"\n",
"import plotly\n",
"import plotly.graph_objs as go\n",
"import plotly.plotly as py\n",
"import plotly.tools as tls\n",
"import plotly.figure_factory as ff\n",
"import plotly.io as pio"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Load data\n",
"Load data from the `./data/interim/` folder and parse into `pandas` dataframes."
]
},
{
"cell_type": "code",
"execution_count": 83,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-03T02:20:29.132099Z",
"start_time": "2018-12-03T02:20:22.217681Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Importing profiles.csv\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\z5189959\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\numpy\\lib\\arraysetops.py:472: FutureWarning:\n",
"\n",
"elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison\n",
"\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"Importing profile_features.csv\n",
"Importing impacts_forecasted_foreshore_slope_sto06.csv\n",
"Importing impacts_forecasted_mean_slope_sto06.csv\n",
"Importing impacts_observed.csv\n",
"Importing twl_foreshore_slope_sto06.csv\n",
"Importing twl_mean_slope_sto06.csv\n",
"Done!\n"
]
}
],
"source": [
"def df_from_csv(csv, index_col, data_folder='../data/interim'):\n",
" print('Importing {}'.format(csv))\n",
" return pd.read_csv(os.path.join(data_folder,csv), index_col=index_col)\n",
"\n",
"df_profiles = df_from_csv('profiles.csv', index_col=[0, 1, 2])\n",
"df_profile_features = df_from_csv('profile_features.csv', index_col=[0])\n",
"\n",
"impacts = {\n",
" 'forecasted': {\n",
" 'foreshore_slope_sto06': df_from_csv('impacts_forecasted_foreshore_slope_sto06.csv', index_col=[0]),\n",
" 'mean_slope_sto06': df_from_csv('impacts_forecasted_mean_slope_sto06.csv', index_col=[0]),\n",
" },\n",
" 'observed': df_from_csv('impacts_observed.csv', index_col=[0])\n",
" }\n",
"\n",
"twls = {\n",
" 'forecasted': {\n",
" 'foreshore_slope_sto06': df_from_csv('twl_foreshore_slope_sto06.csv', index_col=[0, 1]),\n",
" 'mean_slope_sto06':df_from_csv('twl_mean_slope_sto06.csv', index_col=[0, 1]),\n",
" }\n",
"}\n",
"\n",
"print('Done!')"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Lets define a function to calculate the \"collision protection volume\" based on prestorm profiles."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-03T00:37:37.244970Z",
"start_time": "2018-12-03T00:37:36.924017Z"
},
"code_folding": []
},
"outputs": [],
"source": [
"from shapely.geometry import Point, LineString, Polygon\n",
"\n",
"def collision_protection_vol(x,z, d_low_x, d_low_z, lower_z, angle):\n",
" # First, get the bounding line strings of our protection volume\n",
" lower_line = LineString([Point(min(x), lower_z), Point(max(x), lower_z)])\n",
" profile_line = LineString([Point(x_coord, z_coord) for x_coord, z_coord in zip(x,z) \n",
" if all([not np.isnan(x_coord), not np.isnan(z_coord)])])\n",
" slope_line = LineString([Point(d_low_x, d_low_z), \n",
" Point(max(x), d_low_z - max(x) * np.sin(np.deg2rad(angle)))])\n",
"\n",
" # Work out where our lower line and slope line intersect\n",
" lower_profile_intersection = lower_line.intersection(profile_line)\n",
" d_protected_intersection = lower_line.intersection(slope_line)\n",
" \n",
" # Define the perimeter of the protection area\n",
" profile_protected = LineString([Point(x_coord, z_coord) for x_coord, z_coord \n",
" in zip(profile_line.xy[0],profile_line.xy[1]) \n",
" if d_low_x < x_coord < lower_profile_intersection.xy[0][0]] \n",
" + [lower_profile_intersection]\n",
" + [d_protected_intersection]\n",
" + [Point(d_low_x, d_low_z)])\n",
" \n",
" # Convert to polygon and return the area (m3/m)\n",
" protection_area_poly = Polygon(profile_protected)\n",
" protection_area_vol = protection_area_poly.area\n",
" return protection_area_vol\n",
"\n",
"site_id = 'NARRA0018'\n",
"profile_type = 'prestorm'\n",
"query = \"site_id == '{}' and profile_type == '{}'\".format(site_id, profile_type)\n",
"prestorm_profile = df_profiles.query(query)\n",
"profile_features = df_profile_features.query(query)\n",
"\n",
"x = prestorm_profile.index.get_level_values('x')\n",
"z = prestorm_profile.z\n",
"d_low_x = profile_features.dune_toe_x.tolist()[0]\n",
"d_low_z = profile_features.dune_toe_z.tolist()[0]\n",
"angle = 60 # degrees from the horizontal\n",
"lower_z = 0.5 # from mhw\n",
"\n",
"vol = collision_protection_vol(x,z, d_low_x, d_low_z, lower_z, angle)"
]
},
{
"cell_type": "code",
"execution_count": 58,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-03T01:24:18.270476Z",
"start_time": "2018-12-03T01:24:18.119986Z"
}
},
"outputs": [],
"source": [
"from datetime import timedelta\n",
"\n",
"def wl_time(t, wl, z_lower, z_upper):\n",
" \"\"\"\n",
" Returns the amount of time the water level is between two elevations.\n",
" \"\"\"\n",
" df_wl = pd.DataFrame.from_records([(t_val, R2_val) for t_val, R2_val in zip(t,R2)], columns=['datetime','wl'])\n",
" df_wl.set_index(pd.DatetimeIndex(df_wl['datetime']),inplace=True)\n",
" df_wl.drop(columns=['datetime'], inplace=True)\n",
" \n",
" # Assumes that each record is one hour... probably need to check this\n",
" hours = len(df_wl.query('{} < wl < {}'.format(z_lower, z_upper)))\n",
" return timedelta(hours=hours)\n",
"\n",
"def wave_power(t, wl, z_lower, z_upper, Hs0, Tp):\n",
" \"\"\"\n",
" Returns the cumulative wave power when the water level is between two elevations.\n",
" \"\"\"\n",
" df_wl = pd.DataFrame.from_records([(t_val, R2_val,Hs0_val,Tp_val) for t_val, R2_val,Hs0_val,Tp_val in zip(t,R2,Hs0,Tp)], columns=['datetime','wl', 'Hs0','Tp'])\n",
" df_wl.set_index(pd.DatetimeIndex(df_wl['datetime']),inplace=True)\n",
" df_wl.drop(columns=['datetime'], inplace=True)\n",
" \n",
" # Assumes that each record is one hour... probably need to check this\n",
" rho = 1025 # kg/m3\n",
" g = 9.8 # m/s2\n",
" df_wl_times = df_wl.query('{} < wl < {}'.format(z_lower, z_upper))\n",
" power = rho * g ** 2 / 64 / np.pi * df_wl_times.Hs0 ** 2 * df_wl_times.Tp\n",
" return power.sum()\n",
"\n",
"df_twl = twls['forecasted']['mean_slope_sto06']\n",
"df_twl_site = df_twl.query(\"site_id == '{}'\".format(site_id))\n",
"\n",
"R2 = df_twl_site.R2.tolist()\n",
"t = df_twl_site.index.get_level_values('datetime')\n",
"z_lower = 0.5\n",
"z_upper = d_low_z\n",
"\n",
"exposed_time = wl_time(t, R2, z_lower,z_upper)\n",
"\n",
"Hs0 = df_twl.Hs0.tolist()\n",
"Tp = df_twl.Tp.tolist()\n",
"wave_p = wave_power(t, R2, z_lower,z_upper,Hs0, Tp)\n"
]
},
{
"cell_type": "code",
"execution_count": 59,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-03T01:24:24.215223Z",
"start_time": "2018-12-03T01:24:24.210209Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"8554715.596323118"
]
},
"execution_count": 59,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"wave_p"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-03T00:54:57.439956Z",
"start_time": "2018-12-03T00:54:57.425899Z"
}
},
"outputs": [],
"source": [
"def dune_toe_elevation_change(site_id, df_profile_features):\n",
" query = \"site_id == '{}'\".format(site_id)\n",
" profile_features = df_profile_features.query(query)\n",
" prestorm_dune_toe_z = profile_features.query(\"profile_type=='prestorm'\").dune_toe_z.tolist()[0]\n",
" poststorm_dune_toe_z = profile_features.query(\"profile_type=='poststorm'\").dune_toe_z.tolist()[0]\n",
" return prestorm_dune_toe_z - poststorm_dune_toe_z\n",
"\n",
"toe_ele_change = dune_toe_elevation_change(\"NARRA0018\", df_profile_features)"
]
},
{
"cell_type": "code",
"execution_count": 92,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-03T03:07:48.328428Z",
"start_time": "2018-12-03T03:06:54.182343Z"
}
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"0 of 204\n",
"20 of 204\n",
"40 of 204\n",
"60 of 204\n",
"80 of 204\n",
"100 of 204\n",
"120 of 204\n",
"140 of 204\n",
"160 of 204\n",
"180 of 204\n",
"200 of 204\n"
]
}
],
"source": [
"vols = []\n",
"exposed_times = []\n",
"toe_ele_changes = []\n",
"wave_powers = []\n",
"\n",
"# Get site ids where we observed collision\n",
"observed_site_ids = impacts['observed'].query(\"storm_regime=='collision'\").index.get_level_values('site_id').unique()\n",
"\n",
"# Get site ids where we forecast swash\n",
"forecasted_site_ids = impacts['forecasted']['mean_slope_sto06'].query(\"storm_regime=='swash'\").index.get_level_values('site_id').unique()\n",
"\n",
"site_ids = set(observed_site_ids).intersection(set(forecasted_site_ids))\n",
"\n",
"# Calculate for each site\n",
"\n",
"for n, site_id in enumerate(site_ids):\n",
" \n",
" if n%20 ==0:\n",
" print('{} of {}'.format(n, len(site_ids)))\n",
" \n",
" try:\n",
" query = \"site_id == '{}' and profile_type == '{}'\".format(site_id, 'prestorm')\n",
" prestorm_profile = df_profiles.query(query)\n",
" profile_features = df_profile_features.query(query)\n",
"\n",
" vol = collision_protection_vol(x = prestorm_profile.index.get_level_values('x'),\n",
" z = prestorm_profile.z,\n",
" d_low_x = profile_features.dune_toe_x.tolist()[0],\n",
" d_low_z = profile_features.dune_toe_z.tolist()[0],\n",
" lower_z = profile_features.dune_toe_z.tolist()[0] - 2, # from mhw\n",
" angle = 60, # degrees from the horizontal\n",
" )\n",
"\n",
" df_twl = twls['forecasted']['mean_slope_sto06']\n",
" df_twl_site = df_twl.query(\"site_id == '{}'\".format(site_id))\n",
"\n",
" exposed_time = wl_time(t = df_twl_site.index.get_level_values('datetime'),\n",
" wl = df_twl_site.R2.tolist(),\n",
" z_lower = profile_features.dune_toe_z.tolist()[0] -2,\n",
" z_upper = profile_features.dune_toe_z.tolist()[0],\n",
" )\n",
"\n",
" \n",
" power = wave_power(t = df_twl_site.index.get_level_values('datetime'),\n",
" wl = df_twl_site.R2.tolist(),\n",
" z_lower = profile_features.dune_toe_z.tolist()[0] -2,\n",
" z_upper = profile_features.dune_toe_z.tolist()[0],\n",
" Hs0=df_twl_site.Hs0.tolist(),\n",
" Tp=df_twl_site.Tp.tolist())\n",
" \n",
" toe_ele_change = dune_toe_elevation_change(site_id, df_profile_features)\n",
" except:\n",
" continue\n",
"\n",
" vols.append(vol)\n",
" exposed_times.append(exposed_time)\n",
" toe_ele_changes.append(toe_ele_change)\n",
" wave_powers.append(power)\n",
"# if n>100:\n",
"# break\n",
"\n",
" \n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 95,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-03T03:12:11.598150Z",
"start_time": "2018-12-03T03:12:11.590128Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"[0.0,\n",
" 62.0,\n",
" 35.0,\n",
" 53.0,\n",
" 4.0,\n",
" 41.0,\n",
" 31.0,\n",
" 98.0,\n",
" 17.0,\n",
" 103.0,\n",
" 81.0,\n",
" 1.0,\n",
" 31.0,\n",
" 0.0,\n",
" 24.0,\n",
" 35.0,\n",
" 67.0,\n",
" 53.0,\n",
" 77.0,\n",
" 130.0,\n",
" 66.0,\n",
" 89.0,\n",
" 31.0,\n",
" 13.0,\n",
" 41.0,\n",
" 118.0,\n",
" 0.0,\n",
" 29.0,\n",
" 82.0,\n",
" 52.0,\n",
" 84.0,\n",
" 31.0,\n",
" 2.0,\n",
" 43.0,\n",
" 84.0,\n",
" 421.0,\n",
" 29.0,\n",
" 22.0,\n",
" 54.0,\n",
" 150.0,\n",
" 115.0,\n",
" 46.0,\n",
" 29.0,\n",
" 86.0,\n",
" 103.0,\n",
" 82.0,\n",
" 77.0,\n",
" 50.0,\n",
" 104.0,\n",
" 81.0,\n",
" 67.0,\n",
" 81.0,\n",
" 141.0,\n",
" 64.0,\n",
" 17.0,\n",
" 95.0,\n",
" 46.0,\n",
" 80.0,\n",
" 77.0,\n",
" 4.0,\n",
" 159.0,\n",
" 115.0,\n",
" 33.0,\n",
" 13.0,\n",
" 46.0,\n",
" 110.0,\n",
" 162.0,\n",
" 16.0,\n",
" 77.0,\n",
" 77.0,\n",
" 86.0,\n",
" 46.0,\n",
" 6.0,\n",
" 42.0,\n",
" 77.0,\n",
" 89.0,\n",
" 29.0,\n",
" 172.0,\n",
" 68.0,\n",
" 204.0,\n",
" 8.0,\n",
" 13.0,\n",
" 78.0,\n",
" 0.0,\n",
" 81.0,\n",
" 156.0,\n",
" 57.0,\n",
" 0.0,\n",
" 62.0,\n",
" 46.0,\n",
" 37.0,\n",
" 52.0,\n",
" 310.0,\n",
" 287.0,\n",
" 4.0,\n",
" 89.0,\n",
" 2.0,\n",
" 22.0,\n",
" 31.0,\n",
" 20.0,\n",
" 45.0,\n",
" 54.0,\n",
" 46.0,\n",
" 43.0,\n",
" 0.0,\n",
" 89.0,\n",
" 122.0,\n",
" 5.0,\n",
" 46.0,\n",
" 24.0,\n",
" 0.0,\n",
" 77.0,\n",
" 51.0,\n",
" 0.0,\n",
" 43.0,\n",
" 53.0,\n",
" 151.0,\n",
" 52.0,\n",
" 29.0,\n",
" 103.0,\n",
" 35.0,\n",
" 68.0,\n",
" 17.0,\n",
" 29.0,\n",
" 34.0,\n",
" 211.0,\n",
" 55.0,\n",
" 85.0,\n",
" 21.0,\n",
" 14.0,\n",
" 103.0,\n",
" 227.0,\n",
" 208.0,\n",
" 78.0,\n",
" 43.0,\n",
" 17.0,\n",
" 104.0,\n",
" 50.0,\n",
" 37.0,\n",
" 54.0,\n",
" 78.0,\n",
" 349.0,\n",
" 80.0,\n",
" 49.0,\n",
" 29.0,\n",
" 17.0,\n",
" 82.0,\n",
" 91.0,\n",
" 1.0,\n",
" 75.0,\n",
" 46.0,\n",
" 210.0,\n",
" 205.0,\n",
" 16.0,\n",
" 35.0,\n",
" 82.0,\n",
" 49.0,\n",
" 0.0,\n",
" 29.0,\n",
" 58.0,\n",
" 57.0,\n",
" 103.0,\n",
" 29.0,\n",
" 0.0,\n",
" 46.0,\n",
" 48.0,\n",
" 1.0,\n",
" 17.0,\n",
" 48.0,\n",
" 29.0,\n",
" 17.0,\n",
" 165.0,\n",
" 45.0,\n",
" 17.0,\n",
" 426.0,\n",
" 30.0]"
]
},
"execution_count": 95,
"metadata": {},
"output_type": "execute_result"
}
],
"source": []
},
{
"cell_type": "code",
"execution_count": 104,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-03T03:31:19.534072Z",
"start_time": "2018-12-03T03:31:19.439822Z"
}
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "01b5e4786fd44414a38db9266df25a12",
"version_major": 2,
"version_minor": 0
},
"text/html": [
"<p>Failed to display Jupyter Widget of type <code>FigureWidget</code>.</p>\n",
"<p>\n",
" If you're reading this message in the Jupyter Notebook or JupyterLab Notebook, it may mean\n",
" that the widgets JavaScript is still loading. If this message persists, it\n",
" likely means that the widgets JavaScript library is either not installed or\n",
" not enabled. See the <a href=\"https://ipywidgets.readthedocs.io/en/stable/user_install.html\">Jupyter\n",
" Widgets Documentation</a> for setup instructions.\n",
"</p>\n",
"<p>\n",
" If you're reading this message in another frontend (for example, a static\n",
" rendering on GitHub or <a href=\"https://nbviewer.jupyter.org/\">NBViewer</a>),\n",
" it may mean that your frontend doesn't currently support widgets.\n",
"</p>\n"
],
"text/plain": [
"FigureWidget({\n",
" 'data': [{'marker': {'color': [0.6740000000000004, -0.262, 0.5449999999999999,\n",
" 0.35399999999999965, 0.3929999999999998,\n",
" 0.35399999999999965, 0.6699999999999999,\n",
" -0.22799999999999976, 1.0739999999999998,\n",
" -0.125, 0.35199999999999987, 0.5299999999999998,\n",
" 0.4109999999999996, -0.1120000000000001,\n",
" 0.9180000000000001, 0.621, -0.3579999999999992,\n",
" -0.20699999999999985, -0.48400000000000043,\n",
" 0.5430000000000001, -0.09600000000000053,\n",
" -0.41700000000000026, 0.4340000000000006,\n",
" 0.7559999999999998, 0.8720000000000003,\n",
" -0.5759999999999996, 0.5119999999999996,\n",
" 0.6440000000000001, 0.395, 0.09300000000000042,\n",
" 0.923, 0.4339999999999997, 0.5429999999999993,\n",
" -0.09699999999999998, -0.20899999999999963,\n",
" -0.8130000000000002, 0.706, 0.36399999999999944,\n",
" 0.34099999999999975, -0.08499999999999996,\n",
" 0.21799999999999953, 0.6240000000000006,\n",
" -0.16700000000000026, -0.278,\n",
" -0.5110000000000001, 0.726,\n",
" -0.35199999999999987, 0.13100000000000023,\n",
" -0.3440000000000003, 0.6760000000000002,\n",
" -0.5719999999999996, -0.4980000000000002,\n",
" -0.2020000000000004, 0.34199999999999964,\n",
" 0.41999999999999993, 0.5800000000000001,\n",
" 0.7200000000000002, 0.6230000000000002,\n",
" -0.49100000000000055, 0.11499999999999977,\n",
" -0.242, -0.6240000000000006, 0.9500000000000002,\n",
" 1.2479999999999998, 1.2889999999999997,\n",
" 0.021999999999999797, -0.3200000000000003,\n",
" 0.7829999999999999, -0.32899999999999974,\n",
" 0.3389999999999995, -0.01599999999999957,\n",
" 0.38399999999999945, -0.04599999999999982,\n",
" 0.4849999999999999, 0.02499999999999991,\n",
" -0.7749999999999999, 0.617,\n",
" -0.06500000000000039, 0.5589999999999997,\n",
" -0.1299999999999999, -0.0040000000000000036,\n",
" 1.298, 0.05500000000000016, 0.9689999999999999,\n",
" -0.28800000000000026, -0.09700000000000042,\n",
" -0.03100000000000014, 0.7960000000000003,\n",
" 0.33599999999999985, 0.28900000000000015, 0.798,\n",
" -0.05900000000000016, -0.0029999999999996696,\n",
" -0.15399999999999991, 0.31999999999999984,\n",
" -0.613, 0.2650000000000001, 0.258, 1.513,\n",
" 0.36199999999999966, 0.7849999999999997,\n",
" -0.28900000000000015, 1.0290000000000004,\n",
" 0.8260000000000005, -0.03799999999999981,\n",
" -0.21300000000000008, -0.492,\n",
" 1.6029999999999998, 0.5699999999999998,\n",
" 0.9300000000000002, 0.0389999999999997,\n",
" -0.3110000000000004, 1.0070000000000001,\n",
" 0.11500000000000021, 0.7269999999999999,\n",
" 0.30100000000000016, -0.5180000000000002,\n",
" 0.40600000000000014, 0.1389999999999998,\n",
" -0.08299999999999974, 1.174,\n",
" -0.29300000000000015, 0.036000000000000476,\n",
" 0.702, 0.49099999999999966, 0.27400000000000047,\n",
" 0.6890000000000005, 0.46199999999999974,\n",
" 0.7839999999999998, 0.2939999999999996,\n",
" 0.013000000000000345, -0.09400000000000075,\n",
" 0.022999999999999687, -0.6230000000000002,\n",
" 0.9040000000000004, 0.027000000000000135,\n",
" -0.1280000000000001, 0.25, 0.488,\n",
" -0.1200000000000001, 0.43599999999999994,\n",
" 0.04999999999999982, 0.11599999999999966,\n",
" 1.5290000000000001, 1.0189999999999997,\n",
" 0.5780000000000003, -0.4969999999999999,\n",
" -0.39800000000000013, 0.6430000000000002,\n",
" -0.04500000000000037, -0.40700000000000003,\n",
" 0.07000000000000028, -0.18599999999999994,\n",
" 1.4900000000000002, 0.2889999999999997,\n",
" -0.3719999999999999, 0.1519999999999997,\n",
" 0.10899999999999999, -0.3700000000000001,\n",
" 0.7320000000000002, -0.238,\n",
" -0.08900000000000041, 0.20699999999999985,\n",
" 0.9870000000000001, 1.9829999999999997,\n",
" 0.6460000000000004, 0.06100000000000039,\n",
" 0.06300000000000017, -0.03500000000000014,\n",
" 0.5730000000000004, 0.7640000000000002,\n",
" -0.7690000000000006, 0.5750000000000002,\n",
" 1.4529999999999998, 0.07500000000000018, 0.649],\n",
" 'colorscale': 'Viridis',\n",
" 'showscale': True,\n",
" 'size': 4},\n",
" 'mode': 'markers',\n",
" 'text': [0.6740000000000004<br>STOCS0025, -0.262<br>NINEMn0049,\n",
" 0.5449999999999999<br>NINEMn0043,\n",
" 0.35399999999999965<br>LHOUSEn0056,\n",
" 0.3929999999999998<br>CRESn0120,\n",
" 0.35399999999999965<br>BOOM0008,\n",
" 0.6699999999999999<br>NINEMn0028,\n",
" -0.22799999999999976<br>DIAMONDn0028,\n",
" 1.0739999999999998<br>NINEMs0019, -0.125<br>DUNBn0032,\n",
" 0.35199999999999987<br>DUNBn0048,\n",
" 0.5299999999999998<br>MANNING0076,\n",
" 0.4109999999999996<br>DIAMONDn0014,\n",
" -0.1120000000000001<br>NARRA0008,\n",
" 0.9180000000000001<br>NINEMn0036, 0.621<br>BILG0005,\n",
" -0.3579999999999992<br>CRESn0085,\n",
" -0.20699999999999985<br>SWRO0009,\n",
" -0.48400000000000043<br>NINEMs0027,\n",
" 0.5430000000000001<br>NINEMs0012,\n",
" -0.09600000000000053<br>ONEMILE0006,\n",
" -0.41700000000000026<br>CRESn0066,\n",
" 0.4340000000000006<br>NINEMn0018,\n",
" 0.7559999999999998<br>DUNBn0033,\n",
" 0.8720000000000003<br>NINEMs0036,\n",
" -0.5759999999999996<br>ENTRA0074,\n",
" 0.5119999999999996<br>NINEMn0037,\n",
" 0.6440000000000001<br>DUNBn0035, 0.395<br>CRESn0103,\n",
" 0.09300000000000042<br>NINEMs0038, 0.923<br>MONA0011,\n",
" 0.4339999999999997<br>STUART0041,\n",
" 0.5429999999999993<br>NAMB0070,\n",
" -0.09699999999999998<br>NINEMs0013,\n",
" -0.20899999999999963<br>NINEMs0047,\n",
" -0.8130000000000002<br>NINEMs0057, 0.706<br>NINEMn0053,\n",
" 0.36399999999999944<br>NINEMn0052,\n",
" 0.34099999999999975<br>ENTRA0067,\n",
" -0.08499999999999996<br>NINEMs0014,\n",
" 0.21799999999999953<br>STOCNn0047,\n",
" 0.6240000000000006<br>ENTRA0073,\n",
" -0.16700000000000026<br>NINEMs0001, -0.278<br>NINEMn0042,\n",
" -0.5110000000000001<br>ONEMILE0003, 0.726<br>GRANTSs0002,\n",
" -0.35199999999999987<br>NSHORE_n0021,\n",
" 0.13100000000000023<br>AVOCAn0008,\n",
" -0.3440000000000003<br>ENTRA0069,\n",
" 0.6760000000000002<br>NINEMs0032,\n",
" -0.5719999999999996<br>NINEMs0048,\n",
" -0.4980000000000002<br>CRESn0105,\n",
" -0.2020000000000004<br>NINEMs0031,\n",
" 0.34199999999999964<br>DUNBn0047,\n",
" 0.41999999999999993<br>STUART0050,\n",
" 0.5800000000000001<br>BLUEYS0004,\n",
" 0.7200000000000002<br>SWRO0006,\n",
" 0.6230000000000002<br>NINEMs0044,\n",
" -0.49100000000000055<br>NINEMs0020,\n",
" 0.11499999999999977<br>NINEMs0039, -0.242<br>SWRO0010,\n",
" -0.6240000000000006<br>NINEMn0047,\n",
" 0.9500000000000002<br>NAMB0068,\n",
" 1.2479999999999998<br>OLDBAR0025,\n",
" 1.2889999999999997<br>MANNING0094,\n",
" 0.021999999999999797<br>NINEMs0005,\n",
" -0.3200000000000003<br>ONEMILE0010,\n",
" 0.7829999999999999<br>GRANTSn0018,\n",
" -0.32899999999999974<br>NINEMs0028,\n",
" 0.3389999999999995<br>NSHORE_n0031,\n",
" -0.01599999999999957<br>WAMBE0012,\n",
" 0.38399999999999945<br>NARRA0024,\n",
" -0.04599999999999982<br>ONEMILE0002,\n",
" 0.4849999999999999<br>LHOUSE0006,\n",
" 0.02499999999999991<br>WAMBE0014,\n",
" -0.7749999999999999<br>DIAMONDn0013, 0.617<br>DIAMONDn0034,\n",
" -0.06500000000000039<br>ELIZA0005,\n",
" 0.5589999999999997<br>OLDBAR0023,\n",
" -0.1299999999999999<br>ENTRA0046,\n",
" -0.0040000000000000036<br>DIAMONDn0039, 1.298<br>NINEMs0040,\n",
" 0.05500000000000016<br>NINEMs0017,\n",
" 0.9689999999999999<br>NINEMn0051,\n",
" -0.28800000000000026<br>CATHIE0012,\n",
" -0.09700000000000042<br>NAMB0059,\n",
" -0.03100000000000014<br>CRESn0112,\n",
" 0.7960000000000003<br>STOCS0015,\n",
" 0.33599999999999985<br>LHOUSEn0028,\n",
" 0.28900000000000015<br>NINEMs0003, 0.798<br>STUART0045,\n",
" -0.05900000000000016<br>WAMBE0013,\n",
" -0.0029999999999996696<br>NINEMs0018,\n",
" -0.15399999999999991<br>BLUEYS0002,\n",
" 0.31999999999999984<br>NINEMs0011, -0.613<br>STUART0036,\n",
" 0.2650000000000001<br>ELIZA0003, 0.258<br>NARRA0020,\n",
" 1.513<br>NSHORE_n0028, 0.36199999999999966<br>ELIZA0007,\n",
" 0.7849999999999997<br>STOCNn0010,\n",
" -0.28900000000000015<br>STUART0058,\n",
" 1.0290000000000004<br>STOCNn0008,\n",
" 0.8260000000000005<br>STOCS0002,\n",
" -0.03799999999999981<br>NINEMs0026,\n",
" -0.21300000000000008<br>WAMBE0009, -0.492<br>MONA0009,\n",
" 1.6029999999999998<br>NARRA0022,\n",
" 0.5699999999999998<br>OLDBAR0021,\n",
" 0.9300000000000002<br>NSHORE_n0029,\n",
" 0.0389999999999997<br>ONEMILE0008,\n",
" -0.3110000000000004<br>LHOUSEn0042,\n",
" 1.0070000000000001<br>NARRA0021,\n",
" 0.11500000000000021<br>STOCS0029,\n",
" 0.7269999999999999<br>BLUEYS0001,\n",
" 0.30100000000000016<br>BOOM0009,\n",
" -0.5180000000000002<br>MANNING0042,\n",
" 0.40600000000000014<br>NINEMn0046,\n",
" 0.1389999999999998<br>LHOUSEn0069,\n",
" -0.08299999999999974<br>STOCNs0192, 1.174<br>ENTRA0065,\n",
" -0.29300000000000015<br>LHOUSEn0025,\n",
" 0.036000000000000476<br>NINEMs0007, 0.702<br>GRANTSn0013,\n",
" 0.49099999999999966<br>MANNING0095,\n",
" 0.27400000000000047<br>NINEMs0043,\n",
" 0.6890000000000005<br>ENTRA0070,\n",
" 0.46199999999999974<br>LHOUSEn0059,\n",
" 0.7839999999999998<br>LHOUSEn0057,\n",
" 0.2939999999999996<br>NINEMs0029,\n",
" 0.013000000000000345<br>LHOUSEn0030,\n",
" -0.09400000000000075<br>NINEMs0008,\n",
" 0.022999999999999687<br>MANNING0092,\n",
" -0.6230000000000002<br>MONA0012,\n",
" 0.9040000000000004<br>NSHORE_n0026,\n",
" 0.027000000000000135<br>DIAMONDn0030,\n",
" -0.1280000000000001<br>MANNING0091, 0.25<br>STUART0043,\n",
" 0.488<br>NSHORE_n0020, -0.1200000000000001<br>ELIZA0004,\n",
" 0.43599999999999994<br>SWRO0005,\n",
" 0.04999999999999982<br>HARR0050,\n",
" 0.11599999999999966<br>FOST0001,\n",
" 1.5290000000000001<br>STOCS0008,\n",
" 1.0189999999999997<br>NARRA0009,\n",
" 0.5780000000000003<br>STUART0037,\n",
" -0.4969999999999999<br>STUART0033,\n",
" -0.39800000000000013<br>STUART0046,\n",
" 0.6430000000000002<br>FOST0004,\n",
" -0.04500000000000037<br>SWRO0001,\n",
" -0.40700000000000003<br>NINEMn0054,\n",
" 0.07000000000000028<br>STOCNs0069,\n",
" -0.18599999999999994<br>STOCNn0004,\n",
" 1.4900000000000002<br>MANNING0084,\n",
" 0.2889999999999997<br>STUART0040,\n",
" -0.3719999999999999<br>NAMB0048,\n",
" 0.1519999999999997<br>BOOM0007,\n",
" 0.10899999999999999<br>NINEMn0034,\n",
" -0.3700000000000001<br>ONEMILE0001,\n",
" 0.7320000000000002<br>ENTRA0075, -0.238<br>STOCNn0011,\n",
" -0.08900000000000041<br>DIAMONDn0021,\n",
" 0.20699999999999985<br>LHOUSEn0060,\n",
" 0.9870000000000001<br>CRESn0064,\n",
" 1.9829999999999997<br>NARRA0007,\n",
" 0.6460000000000004<br>MANNING0073,\n",
" 0.06100000000000039<br>ONEMILE0005,\n",
" 0.06300000000000017<br>NINEMs0037,\n",
" -0.03500000000000014<br>LHOUSEn0061,\n",
" 0.5730000000000004<br>NINEMn0040,\n",
" 0.7640000000000002<br>AVOCAn0005,\n",
" -0.7690000000000006<br>STOCNn0041,\n",
" 0.5750000000000002<br>ELIZA0006,\n",
" 1.4529999999999998<br>ENTRA0072,\n",
" 0.07500000000000018<br>MANNING0082, 0.649<br>LHOUSEn0029],\n",
" 'type': 'scatter',\n",
" 'uid': 'bdcb15ca-50ce-42b2-8441-134aec09d1a6',\n",
" 'x': [0.0, 62.0, 35.0, 53.0, 4.0, 41.0, 31.0, 98.0, 17.0, 103.0,\n",
" 81.0, 1.0, 31.0, 0.0, 24.0, 35.0, 67.0, 53.0, 77.0, 130.0,\n",
" 66.0, 89.0, 31.0, 13.0, 41.0, 118.0, 0.0, 29.0, 82.0, 52.0,\n",
" 84.0, 31.0, 2.0, 43.0, 84.0, 421.0, 29.0, 22.0, 54.0, 150.0,\n",
" 115.0, 46.0, 29.0, 86.0, 103.0, 82.0, 77.0, 50.0, 104.0, 81.0,\n",
" 67.0, 81.0, 141.0, 64.0, 17.0, 95.0, 46.0, 80.0, 77.0, 4.0,\n",
" 159.0, 115.0, 33.0, 13.0, 46.0, 110.0, 162.0, 16.0, 77.0, 77.0,\n",
" 86.0, 46.0, 6.0, 42.0, 77.0, 89.0, 29.0, 172.0, 68.0, 204.0,\n",
" 8.0, 13.0, 78.0, 0.0, 81.0, 156.0, 57.0, 0.0, 62.0, 46.0, 37.0,\n",
" 52.0, 310.0, 287.0, 4.0, 89.0, 2.0, 22.0, 31.0, 20.0, 45.0,\n",
" 54.0, 46.0, 43.0, 0.0, 89.0, 122.0, 5.0, 46.0, 24.0, 0.0, 77.0,\n",
" 51.0, 0.0, 43.0, 53.0, 151.0, 52.0, 29.0, 103.0, 35.0, 68.0,\n",
" 17.0, 29.0, 34.0, 211.0, 55.0, 85.0, 21.0, 14.0, 103.0, 227.0,\n",
" 208.0, 78.0, 43.0, 17.0, 104.0, 50.0, 37.0, 54.0, 78.0, 349.0,\n",
" 80.0, 49.0, 29.0, 17.0, 82.0, 91.0, 1.0, 75.0, 46.0, 210.0,\n",
" 205.0, 16.0, 35.0, 82.0, 49.0, 0.0, 29.0, 58.0, 57.0, 103.0,\n",
" 29.0, 0.0, 46.0, 48.0, 1.0, 17.0, 48.0, 29.0, 17.0, 165.0,\n",
" 45.0, 17.0, 426.0, 30.0],\n",
" 'y': [15.057260981886461, 50.48600703337221, 52.22661963845738,\n",
" 49.87527193413516, 60.378091629296, 44.69467666268621,\n",
" 33.08824662372501, 69.24966143957133, 46.3983426493909,\n",
" 55.66269386408765, 50.5038685904488, 38.24722379458162,\n",
" 48.77392309821484, 34.42678889134076, 32.339772440128606,\n",
" 28.13518326624829, 54.01652317900755, 51.57523510716254,\n",
" 59.03553546603745, 52.45400614301138, 62.599820358965985,\n",
" 70.4542638944535, 24.852993645288876, 38.001197477131235,\n",
" 31.316631841848864, 64.57753852853112, 17.65164087230827,\n",
" 27.89358334754175, 61.85947610858759, 63.58558665629535,\n",
" 52.707965993289484, 54.59027355785616, 53.4369169941986,\n",
" 36.53074365372308, 60.662690901453374, 93.01545825805395,\n",
" 21.321395510574977, 47.03420447676251, 44.784472634287866,\n",
" 67.77932649819007, 77.67132854981324, 49.702151674694086,\n",
" 57.01843446390366, 57.55836238002917, 60.0758110522641,\n",
" 32.33715180121005, 57.2927341040066, 53.685587497734865,\n",
" 77.02236536546766, 46.43886428194846, 74.93504091748079,\n",
" 60.06724901876906, 77.03905086279573, 30.912726190943072,\n",
" 54.53170249189508, 53.70339057156003, 22.441638077872113,\n",
" 54.791537795661974, 62.13997820476877, 29.40727911432272,\n",
" 82.18692443832771, 61.97015902384305, 42.77787059874549,\n",
" 47.91815920377601, 52.11069344547651, 49.79396221773086,\n",
" 73.9414412498821, 37.876215036107936, 57.13461030091145,\n",
" 37.3514512031067, 59.923715953669195, 25.866493800185477,\n",
" 45.53280065268179, 27.02215306756141, 81.15248906718988,\n",
" 71.51536479781095, 45.97756678228884, 69.86050918469093,\n",
" 49.48043946500161, 57.899970620410635, 37.74710860574265,\n",
" 34.57820959659622, 55.62901703497036, 31.875858999358044,\n",
" 62.34650424255848, 73.60708709493487, 50.53187039062722,\n",
" 19.918164614381215, 41.9039188222106, 74.10573605782186,\n",
" 42.98820404001569, 70.89929008060581, 91.11150252345915,\n",
" 103.92435818263927, 25.781875086423824, 65.08855861060485,\n",
" 32.16685072172824, 26.3774436608266, 49.37115355443433,\n",
" 19.700396999896146, 45.0105834352614, 46.43117556836857,\n",
" 25.19648137654068, 58.46871157481417, 16.8505048443866,\n",
" 75.37390874203606, 68.1773833511795, 14.320950372734673,\n",
" 46.84538149567382, 51.48000161377281, 53.437015226686775,\n",
" 45.40805859249032, 40.76201971776089, 50.89636554048608,\n",
" 57.403293218019435, 54.46366012058966, 64.73300675848911,\n",
" 55.16180585094216, 41.57191993591717, 63.75449963841763,\n",
" 35.469027712428435, 56.59236212355033, 31.326546007774674,\n",
" 37.03650824212717, 31.520950268291358, 58.44841826927378,\n",
" 46.28021033720412, 54.90788208817708, 29.509983621209795,\n",
" 34.0063988459262, 64.86742099649922, 59.221944976590606,\n",
" 74.9874011223268, 55.207330372211956, 26.000385560413722,\n",
" 39.945013530743594, 37.27891136273222, 59.478825901465555,\n",
" 57.3560107484194, 57.08482809741879, 24.933290176259288,\n",
" 88.35412756202288, 42.25595601431678, 56.81861249472931,\n",
" 32.63000580753741, 36.79710517558988, 58.3621888814069,\n",
" 70.12310930216574, 34.01482594371291, 58.839577879424155,\n",
" 55.252330933788805, 78.22085308306589, 59.782634298874065,\n",
" 28.36317684006946, 43.8967970926609, 47.27816880026671,\n",
" 21.722947051488013, 19.58764895174499, 38.591489138007844,\n",
" 50.57685864743641, 63.74425935533099, 82.20046361640517,\n",
" 44.20822435998208, 26.438775903302503, 50.05321159752885,\n",
" 54.12827133882625, 24.70991457046442, 60.9358370882951,\n",
" 54.14071472699229, 27.848684395204568, 52.36273443570386,\n",
" 71.01829280596758, 46.862832006518445, 15.790885970513834,\n",
" 89.42388399872287, 53.47096959758166]}],\n",
" 'layout': {'title': 'Dune Collision Protection',\n",
" 'xaxis': {'autorange': True, 'showgrid': True, 'showline': True, 'title': 'Exposed time', 'zeroline': True},\n",
" 'yaxis': {'autorange': True,\n",
" 'showgrid': True,\n",
" 'showline': True,\n",
" 'title': 'Collision protection volume',\n",
" 'zeroline': True}}\n",
"})"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"trace1 = go.Scatter(\n",
" x=[x.total_seconds() / 60 / 60 for x in exposed_times],\n",
" y=vols,\n",
" text = ['{}<br>{}'.format(ele, site_id) for ele,site_id in zip(toe_ele_changes,site_ids)],\n",
" mode='markers',\n",
" marker=dict(\n",
" size=4,\n",
"# color = [-1 if x<0 else 1 for x in toe_ele_changes],\n",
" color = toe_ele_changes,\n",
"# color = wave_powers,\n",
"# color = [x.total_seconds() / 60 / 60 for x in exposed_times],\n",
" colorscale='Viridis',\n",
" showscale=True\n",
" ))\n",
"\n",
"layout = go.Layout(\n",
" title='Dune Collision Protection',\n",
"# height=300,\n",
"# legend=dict(font={'size': 10}),\n",
"# margin=dict(t=50, b=50, l=50, r=20),\n",
" xaxis=dict(\n",
" title='Exposed time',\n",
" autorange=True,\n",
" showgrid=True,\n",
" zeroline=True,\n",
" showline=True,\n",
" ),\n",
" yaxis=dict(\n",
" title='Collision protection volume',\n",
" autorange=True,\n",
" showgrid=True,\n",
" zeroline=True,\n",
" showline=True,\n",
" ))\n",
"\n",
"g_plot = go.FigureWidget(data=[trace1], layout=layout)\n",
"g_plot"
]
}
],
"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.6.4"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
"number_sections": true,
"sideBar": true,
"skip_h1_title": false,
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
},
"varInspector": {
"cols": {
"lenName": 16,
"lenType": 16,
"lenVar": 40
},
"kernels_config": {
"python": {
"delete_cmd_postfix": "",
"delete_cmd_prefix": "del ",
"library": "var_list.py",
"varRefreshCmd": "print(var_dic_list())"
},
"r": {
"delete_cmd_postfix": ") ",
"delete_cmd_prefix": "rm(",
"library": "var_list.r",
"varRefreshCmd": "cat(var_dic_list()) "
}
},
"types_to_exclude": [
"module",
"function",
"builtin_function_or_method",
"instance",
"_Feature"
],
"window_display": false
}
},
"nbformat": 4,
"nbformat_minor": 2
}