Update notebooks

develop
Chris Leaman 7 years ago
parent dcadf0bf12
commit e3b782abbd

File diff suppressed because one or more lines are too long

@ -12,8 +12,8 @@
"execution_count": 1,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-03T00:37:28.874517Z",
"start_time": "2018-12-03T00:37:28.528594Z"
"end_time": "2018-12-05T02:45:14.908283Z",
"start_time": "2018-12-05T02:45:14.556163Z"
}
},
"outputs": [],
@ -28,8 +28,8 @@
"execution_count": 2,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-03T00:37:30.229243Z",
"start_time": "2018-12-03T00:37:28.875519Z"
"end_time": "2018-12-05T02:45:34.323928Z",
"start_time": "2018-12-05T02:45:14.911088Z"
}
},
"outputs": [],
@ -58,11 +58,11 @@
},
{
"cell_type": "code",
"execution_count": 83,
"execution_count": 3,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-03T02:20:29.132099Z",
"start_time": "2018-12-03T02:20:22.217681Z"
"end_time": "2018-12-05T02:45:53.010702Z",
"start_time": "2018-12-05T02:45:34.324930Z"
}
},
"outputs": [
@ -77,7 +77,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\z5189959\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\numpy\\lib\\arraysetops.py:472: FutureWarning:\n",
"C:\\Users\\z5189959\\Desktop\\nsw-2016-storm-impact\\.venv\\lib\\site-packages\\numpy\\lib\\arraysetops.py:522: FutureWarning:\n",
"\n",
"elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison\n",
"\n"
@ -130,13 +130,21 @@
"Lets define a function to calculate the \"collision protection volume\" based on prestorm profiles."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Get berm feature functions\n",
"Define a couple of functions which are going to help us get features of our berms."
]
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 27,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-03T00:37:37.244970Z",
"start_time": "2018-12-03T00:37:36.924017Z"
"end_time": "2018-12-05T03:01:56.646213Z",
"start_time": "2018-12-05T03:01:56.366466Z"
},
"code_folding": []
},
@ -144,6 +152,7 @@
"source": [
"from shapely.geometry import Point, LineString, Polygon\n",
"\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",
@ -169,9 +178,21 @@
" protection_area_vol = protection_area_poly.area\n",
" return protection_area_vol\n",
"\n",
"\n",
"def get_berm_width(z, d_low_x):\n",
" \"\"\"\n",
" Returns the width of the berm, defined by the distance between dune toe to z=0\n",
" \"\"\"\n",
" x_seaward_limit = z.dropna().tail(1).reset_index().x[0]\n",
" return x_seaward_limit - d_low_x\n",
"\n",
"\n",
"\n",
"\n",
"site_id = 'NARRA0018'\n",
"profile_type = 'prestorm'\n",
"query = \"site_id == '{}' and profile_type == '{}'\".format(site_id, profile_type)\n",
"query = \"site_id == '{}' and profile_type == '{}'\".format(\n",
" site_id, profile_type)\n",
"prestorm_profile = df_profiles.query(query)\n",
"profile_features = df_profile_features.query(query)\n",
"\n",
@ -182,16 +203,17 @@
"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)"
"vol = collision_protection_vol(x, z, d_low_x, d_low_z, lower_z, angle)\n",
"berm_width = get_berm_width(z, d_low_x)"
]
},
{
"cell_type": "code",
"execution_count": 58,
"execution_count": 5,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-03T01:24:18.270476Z",
"start_time": "2018-12-03T01:24:18.119986Z"
"end_time": "2018-12-05T02:45:54.224110Z",
"start_time": "2018-12-05T02:45:54.030142Z"
}
},
"outputs": [],
@ -242,39 +264,37 @@
},
{
"cell_type": "code",
"execution_count": 59,
"execution_count": null,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-05T02:45:54.231129Z",
"start_time": "2018-12-05T02:45:54.225660Z"
}
},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 57,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-03T01:24:24.215223Z",
"start_time": "2018-12-03T01:24:24.210209Z"
"end_time": "2018-12-05T03:37:45.472885Z",
"start_time": "2018-12-05T03:37:45.462857Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"8554715.596323118"
"0.96"
]
},
"execution_count": 59,
"execution_count": 57,
"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",
@ -283,16 +303,17 @@
" 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)"
"toe_ele_change = dune_toe_elevation_change(\"MANNING0081\", df_profile_features)\n",
"toe_ele_change"
]
},
{
"cell_type": "code",
"execution_count": 92,
"execution_count": 62,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-03T03:07:48.328428Z",
"start_time": "2018-12-03T03:06:54.182343Z"
"end_time": "2018-12-05T03:45:45.203827Z",
"start_time": "2018-12-05T03:45:13.608478Z"
}
},
"outputs": [
@ -300,17 +321,12 @@
"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"
"0 of 816\n",
"20 of 816\n",
"40 of 816\n",
"60 of 816\n",
"80 of 816\n",
"100 of 816\n"
]
}
],
@ -319,14 +335,20 @@
"exposed_times = []\n",
"toe_ele_changes = []\n",
"wave_powers = []\n",
"berm_widths = []\n",
"swash_vol_changes = []\n",
"dune_face_vol_changes = []\n",
"site_ids_to_plot = []\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",
"# # 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",
"site_ids = set(observed_site_ids).intersection(set(forecasted_site_ids))\n",
"site_ids = observed_site_ids\n",
"\n",
"# Calculate for each site\n",
"\n",
@ -351,12 +373,16 @@
" df_twl = twls['forecasted']['mean_slope_sto06']\n",
" df_twl_site = df_twl.query(\"site_id == '{}'\".format(site_id))\n",
" \n",
" berm_width = get_berm_width(z = prestorm_profile.z,\n",
" d_low_x = profile_features.dune_toe_x.tolist()[0]) \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",
" swash_vol_change = impacts['observed'].query(\"site_id == '{}'\".format(site_id)).swash_vol_change.tolist()[0]\n",
" dune_face_vol_change = impacts['observed'].query(\"site_id == '{}'\".format(site_id)).dune_face_vol_change.tolist()[0]\n",
" \n",
" power = wave_power(t = df_twl_site.index.get_level_values('datetime'),\n",
" wl = df_twl_site.R2.tolist(),\n",
@ -369,12 +395,18 @@
" except:\n",
" continue\n",
" \n",
"# print(site_id, toe_ele_change)\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",
" berm_widths.append(berm_width)\n",
" swash_vol_changes.append(swash_vol_change)\n",
" dune_face_vol_changes.append(dune_face_vol_change)\n",
" site_ids_to_plot.append(site_id)\n",
" \n",
" if n>100:\n",
" break\n",
"\n",
" \n",
"\n"
@ -382,562 +414,38 @@
},
{
"cell_type": "code",
"execution_count": 95,
"execution_count": null,
"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"
}
],
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": 104,
"execution_count": 72,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-03T03:31:19.534072Z",
"start_time": "2018-12-03T03:31:19.439822Z"
"end_time": "2018-12-05T05:03:39.147413Z",
"start_time": "2018-12-05T05:03:39.070207Z"
}
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "01b5e4786fd44414a38db9266df25a12",
"model_id": "225855bac0d0464d9be74917812c19ac",
"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",
" 'data': [{'marker': {'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",
"})"
" 'text': [-0…"
]
},
"metadata": {},
@ -946,18 +454,18 @@
],
"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",
" x=berm_widths,\n",
" y=dune_face_vol_changes,\n",
" text = ['{}<br>{}'.format(ele, site_id) for ele,site_id in zip(toe_ele_changes,site_ids_to_plot)],\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 = toe_ele_changes,\n",
"# color = dune_face_vol_changes,\n",
"# color = [x.total_seconds() / 60 / 60 for x in exposed_times],\n",
" colorscale='Viridis',\n",
" showscale=True\n",
"# colorscale='Viridis',\n",
"# showscale=True\n",
" ))\n",
"\n",
"layout = go.Layout(\n",
@ -966,14 +474,14 @@
"# legend=dict(font={'size': 10}),\n",
"# margin=dict(t=50, b=50, l=50, r=20),\n",
" xaxis=dict(\n",
" title='Exposed time',\n",
" title='Berm width',\n",
" autorange=True,\n",
" showgrid=True,\n",
" zeroline=True,\n",
" showline=True,\n",
" ),\n",
" yaxis=dict(\n",
" title='Collision protection volume',\n",
" title='Dune face vol change',\n",
" autorange=True,\n",
" showgrid=True,\n",
" zeroline=True,\n",
@ -983,6 +491,74 @@
"g_plot = go.FigureWidget(data=[trace1], layout=layout)\n",
"g_plot"
]
},
{
"cell_type": "code",
"execution_count": 51,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-05T03:15:46.517975Z",
"start_time": "2018-12-05T03:15:46.512936Z"
}
},
"outputs": [
{
"data": {
"text/plain": [
"[64.5799,\n",
" 21.0163,\n",
" 38.106,\n",
" 28.101,\n",
" 58.7247,\n",
" 33.5534,\n",
" 71.1675,\n",
" 52.6043,\n",
" 50.5765,\n",
" 39.9074,\n",
" 67.8385,\n",
" 43.9043,\n",
" 39.8181,\n",
" 37.7153,\n",
" 20.4454,\n",
" 39.7757,\n",
" 42.1843,\n",
" 33.6152,\n",
" 42.9587,\n",
" 39.9773,\n",
" 35.7835,\n",
" 31.2884,\n",
" -0.4618,\n",
" 31.0094,\n",
" 33.3479,\n",
" 47.8394,\n",
" 32.3566,\n",
" 36.5205,\n",
" 45.7109,\n",
" 16.0687,\n",
" 35.4375,\n",
" 43.327,\n",
" 53.5016,\n",
" 31.0357,\n",
" 47.6528,\n",
" 25.5658,\n",
" 41.0514,\n",
" 28.1645,\n",
" 44.5443,\n",
" 42.925,\n",
" 33.9535,\n",
" 36.2626,\n",
" 35.2536]"
]
},
"execution_count": 51,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"# impacts['observed']\n",
"swash_vol_changes"
]
}
],
"metadata": {
@ -1001,7 +577,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.4"
"version": "3.6.7"
},
"toc": {
"base_numbering": 1,
@ -1014,7 +590,7 @@
"toc_cell": false,
"toc_position": {},
"toc_section_display": true,
"toc_window_display": false
"toc_window_display": true
},
"varInspector": {
"cols": {

@ -12,8 +12,8 @@
"execution_count": 1,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-03T03:38:44.538853Z",
"start_time": "2018-12-03T03:38:44.189514Z"
"end_time": "2018-12-03T23:04:57.331037Z",
"start_time": "2018-12-03T23:04:57.006071Z"
}
},
"outputs": [],
@ -28,8 +28,8 @@
"execution_count": 2,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-03T03:38:46.213387Z",
"start_time": "2018-12-03T03:38:44.781382Z"
"end_time": "2018-12-03T23:04:58.749827Z",
"start_time": "2018-12-03T23:04:57.333943Z"
}
},
"outputs": [],
@ -61,8 +61,8 @@
"execution_count": 3,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-03T03:38:53.297184Z",
"start_time": "2018-12-03T03:38:46.365829Z"
"end_time": "2018-12-03T23:05:05.800496Z",
"start_time": "2018-12-03T23:04:58.751721Z"
}
},
"outputs": [
@ -77,7 +77,7 @@
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\z5189959\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\numpy\\lib\\arraysetops.py:472: FutureWarning:\n",
"C:\\Users\\z5189959\\Desktop\\nsw-2016-storm-impact\\.venv\\lib\\site-packages\\numpy\\lib\\arraysetops.py:522: FutureWarning:\n",
"\n",
"elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison\n",
"\n"
@ -127,162 +127,158 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"### Compare underpredicted cases"
"### Compare predicted R_high with D_low\n",
"Let's see what the distribution of R_high is compared with D_low. How far off are the predicted water levels compared with the dune toes?"
]
},
{
"cell_type": "code",
"execution_count": 39,
"execution_count": 29,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-03T04:05:30.984007Z",
"start_time": "2018-12-03T04:05:30.805508Z"
"end_time": "2018-12-04T02:20:58.446500Z",
"start_time": "2018-12-04T02:20:58.439480Z"
}
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>dune_toe_z</th>\n",
" <th>R_high</th>\n",
" <th>diff</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>AVOCAn0005</th>\n",
" <td>3.306</td>\n",
" <td>3.260440</td>\n",
" <td>-0.045560</td>\n",
" </tr>\n",
" <tr>\n",
" <th>AVOCAn0008</th>\n",
" <td>3.507</td>\n",
" <td>3.220084</td>\n",
" <td>-0.286916</td>\n",
" </tr>\n",
" <tr>\n",
" <th>BILG0005</th>\n",
" <td>4.807</td>\n",
" <td>3.293445</td>\n",
" <td>-1.513555</td>\n",
" </tr>\n",
" <tr>\n",
" <th>BLUEYS0001</th>\n",
" <td>3.064</td>\n",
" <td>2.800144</td>\n",
" <td>-0.263856</td>\n",
" </tr>\n",
" <tr>\n",
" <th>BLUEYS0002</th>\n",
" <td>2.929</td>\n",
" <td>2.470641</td>\n",
" <td>-0.458359</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" dune_toe_z R_high diff\n",
"AVOCAn0005 3.306 3.260440 -0.045560\n",
"AVOCAn0008 3.507 3.220084 -0.286916\n",
"BILG0005 4.807 3.293445 -1.513555\n",
"BLUEYS0001 3.064 2.800144 -0.263856\n",
"BLUEYS0002 2.929 2.470641 -0.458359"
]
},
"execution_count": 39,
"metadata": {},
"output_type": "execute_result"
}
],
"outputs": [],
"source": [
"# Find site_ids where the forecast has been underpredicted\n",
"set1 = set(impacts['forecasted']['mean_slope_sto06'].query(\"storm_regime == 'swash'\").index.get_level_values('site_id'))\n",
"set2 = set(impacts['observed'].query(\"storm_regime == 'collision'\").index.get_level_values('site_id'))\n",
"site_ids = list(set1.intersection(set2))\n",
"def get_site_ids(df_forecasted, df_observed, forecasted_regime, observed_regime):\n",
" \"\"\"\n",
" Returns list of site_ids which match the given forecasted and observed regime\n",
" \"\"\"\n",
" set1 = set(df_forecasted.query(\"storm_regime == '{}'\".format(\n",
" forecasted_regime)).index.get_level_values('site_id'))\n",
" set2 = set(df_observed.query(\"storm_regime == '{}'\".format(\n",
" observed_regime)).index.get_level_values('site_id'))\n",
" return sorted(list(set1.intersection(set2)))\n",
"\n",
"\n",
"def get_R_high_D_low_diff(site_ids, df_profile_features, df_twls):\n",
" \"\"\"\n",
" Returns a dataframe of the difference between the R_high and D_low differences. \n",
" Positive values indicate R_high is larger than D_low.\n",
" \"\"\"\n",
" # Get dune toes at these sites and predicted max R_high\n",
"df_toes = df_profile_features.loc[site_ids].query('profile_type==\"prestorm\"').dune_toe_z\n",
"df_R_highs = twls['forecasted']['mean_slope_sto06'].loc[site_ids].groupby('site_id')['R_high'].max()\n",
" df_toes = df_profile_features.loc[site_ids].query(\n",
" 'profile_type==\"prestorm\"').dune_toe_z\n",
" df_R_highs = df_twls.loc[site_ids].groupby('site_id')['R_high'].max()\n",
"\n",
" # Join into one dataframe\n",
" df_twl_toes = pd.concat([df_toes, df_R_highs], axis=1, sort=True)\n",
" df_twl_toes['diff'] = df_twl_toes['R_high'] - df_twl_toes['dune_toe_z']\n",
"df_twl_toes.head()\n"
" return df_twl_toes['diff']\n"
]
},
{
"cell_type": "markdown",
"cell_type": "code",
"execution_count": 53,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-04T03:55:51.858020Z",
"start_time": "2018-12-04T03:55:50.879155Z"
}
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "94883b85733444528fe8a73379ce4611",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"FigureWidget({\n",
" 'data': [{'marker': {'color': '#ef8a62'},\n",
" 'name': 'Overpredicted',\n",
" …"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"Now let's plot the comparison between our R_high TWL values and the dune toes to see how far off they were."
"swash_overpredicted_site_ids = get_site_ids(df_forecasted=impacts['forecasted']['mean_slope_sto06'],\n",
" df_observed=impacts['observed'],\n",
" forecasted_regime='collision',\n",
" observed_regime='swash')\n",
"swash_overpredicted_diffs = get_R_high_D_low_diff(site_ids=swash_overpredicted_site_ids,\n",
" df_profile_features=df_profile_features,\n",
" df_twls=twls['forecasted']['mean_slope_sto06'])\n",
"\n",
"swash_correct_site_ids = get_site_ids(df_forecasted=impacts['forecasted']['mean_slope_sto06'],\n",
" df_observed=impacts['observed'],\n",
" forecasted_regime='swash',\n",
" observed_regime='swash')\n",
"swash_correct_diffs = get_R_high_D_low_diff(site_ids=swash_correct_site_ids,\n",
" df_profile_features=df_profile_features,\n",
" df_twls=twls['forecasted']['mean_slope_sto06'])\n",
"\n",
"\n",
"trace1 = go.Histogram(y=swash_correct_diffs.tolist(),\n",
" opacity=0.75,\n",
" name='Correctly predicted',\n",
" marker=dict(\n",
" color='#67a9cf',\n",
" ),\n",
" ybins=dict(\n",
" size=0.1\n",
"),)\n",
"trace2 = go.Histogram(y=swash_overpredicted_diffs.tolist(),\n",
" opacity=0.75,\n",
" name='Overpredicted',\n",
" marker=dict(\n",
" color='#ef8a62',\n",
"),\n",
" ybins=dict(\n",
" size=0.1\n",
"),)\n",
"\n",
"layout = go.Layout(\n",
" title='R_high - D_low<br>Swash Regime',\n",
" barmode='overlay',\n",
" yaxis=dict(\n",
" title='z (m AHD)'\n",
" ),\n",
" xaxis=dict(\n",
" title='Count'\n",
" ),\n",
" bargap=0.2,\n",
" bargroupgap=0.1,\n",
" legend=dict(x=.6, y=1)\n",
")\n",
"\n",
"g_plot_swash = go.FigureWidget(data=[trace2, trace1], layout=layout)\n",
"\n",
"# To output to file\n",
"img_bytes = pio.write_image(g_plot_swash, 'g_plot_swash.png',format='png', width=600, height=400, scale=5)\n",
"\n",
"g_plot_swash\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 41,
"execution_count": 54,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-03T04:08:15.732169Z",
"start_time": "2018-12-03T04:08:15.656966Z"
"end_time": "2018-12-04T04:10:47.339268Z",
"start_time": "2018-12-04T04:10:45.796887Z"
}
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "35b9331242af473dba2f91761c307022",
"model_id": "3933da9295fe446f9413bca8842100c2",
"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': [{'type': 'histogram',\n",
" 'uid': '75f0d11f-9242-4fc7-b433-1f04e1e37ba6',\n",
" 'y': [-0.045560088746212646, -0.28691603912686325,\n",
" -1.5135547360075963, ..., -0.4613631587476821,\n",
" -0.5212332930925054, -0.3948507473332721]}],\n",
" 'layout': {'bargap': 0.2,\n",
" 'bargroupgap': 0.1,\n",
" 'title': 'D_low - R_high<br>Observed Collision, Forecasted Swash',\n",
" 'xaxis': {'title': 'Count'},\n",
" 'yaxis': {'title': 'z (m AHD)'}}\n",
"})"
" 'data': [{'marker': {'color': '#ef8a62'},\n",
" 'name': 'Underpredicted',\n",
" …"
]
},
"metadata": {},
@ -290,10 +286,45 @@
}
],
"source": [
"trace1 = go.Histogram(y=df_twl_toes['diff'].tolist())\n",
"collision_underpredicted_site_ids = get_site_ids(df_forecasted=impacts['forecasted']['mean_slope_sto06'],\n",
" df_observed=impacts['observed'],\n",
" forecasted_regime='swash',\n",
" observed_regime='collision')\n",
"collision_underpredicted_diffs = get_R_high_D_low_diff(site_ids=collision_underpredicted_site_ids,\n",
" df_profile_features=df_profile_features,\n",
" df_twls=twls['forecasted']['mean_slope_sto06'])\n",
"\n",
"collision_correct_site_ids = get_site_ids(df_forecasted=impacts['forecasted']['mean_slope_sto06'],\n",
" df_observed=impacts['observed'],\n",
" forecasted_regime='collision',\n",
" observed_regime='collision')\n",
"collision_correct_diffs = get_R_high_D_low_diff(site_ids=collision_correct_site_ids,\n",
" df_profile_features=df_profile_features,\n",
" df_twls=twls['forecasted']['mean_slope_sto06'])\n",
"\n",
"\n",
"trace1 = go.Histogram(y=collision_correct_diffs.tolist(),\n",
" opacity=0.75,\n",
" name='Correctly predicted',\n",
" marker=dict(\n",
" color='#67a9cf',\n",
" ),\n",
" ybins=dict(\n",
" size=0.1\n",
"),)\n",
"trace2 = go.Histogram(y=collision_underpredicted_diffs.tolist(),\n",
" opacity=0.75,\n",
" name='Underpredicted',\n",
" marker=dict(\n",
" color='#ef8a62',\n",
" ),\n",
" ybins=dict(\n",
" size=0.1\n",
"),)\n",
"\n",
"layout = go.Layout(\n",
" title='D_low - R_high<br>Observed Collision, Forecasted Swash',\n",
" title='R_high - D_low<br>Collision Regime',\n",
" barmode='overlay',\n",
" yaxis=dict(\n",
" title='z (m AHD)'\n",
" ),\n",
@ -301,172 +332,267 @@
" title='Count'\n",
" ),\n",
" bargap=0.2,\n",
" bargroupgap=0.1\n",
" bargroupgap=0.1,\n",
" legend=dict(x=.6, y=1)\n",
")\n",
"\n",
"g_plot = go.FigureWidget(data=[trace1], layout=layout)\n",
"g_plot"
"g_plot_collision = go.FigureWidget(data=[trace2, trace1], layout=layout)\n",
"\n",
"# To output to file\n",
"img_bytes = pio.write_image(g_plot_collision, 'g_plot_collision.png',format='png', width=600, height=400, scale=5)\n",
"\n",
"g_plot_collision"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The above plot shows that the R_high value for most of the incorrectly forecasted collision regimes, was typically underpredicted by less than 0.5 m."
"### Does dune toe lower?\n"
]
},
{
"cell_type": "markdown",
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "markdown",
"metadata": {
"heading_collapsed": true
},
"source": [
"### What do over predicted and underpredicted profiles look like?"
]
},
{
"cell_type": "markdown",
"metadata": {
"hidden": true
},
"source": [
"### Compare overpredicted cases"
"Define a function for getting the average beach profile for a number of given site_ids:"
]
},
{
"cell_type": "code",
"execution_count": 42,
"execution_count": 156,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-03T04:08:56.128806Z",
"start_time": "2018-12-03T04:08:55.894182Z"
}
"end_time": "2018-12-04T23:11:08.853877Z",
"start_time": "2018-12-04T23:11:08.846876Z"
},
"hidden": true
},
"outputs": [],
"source": [
"def get_avg_profile(site_ids, debug=False):\n",
" rows = []\n",
" for n,site_id in enumerate(site_ids):\n",
" profile = df_profiles.query(\"site_id == '{}' and profile_type == 'prestorm'\".format(site_id))\n",
" profile_z = np.array(profile.z.tolist())\n",
" profile_x = np.array(profile.index.get_level_values('x').tolist())\n",
" \n",
" # Let's center the profile based on the z=0 location\n",
" idx_last_z_val = max(np.argwhere(~np.isnan(profile_z)==True))[0]\n",
" x_last_val = profile_x[idx_last_z_val]\n",
" profile_x = [x - x_last_val for x in profile_x]\n",
" \n",
" # Put values into a dictionary\n",
" for x,z in zip(profile_x, profile_z):\n",
" rows.append({'x':x, 'z': z})\n",
"\n",
" # Return early for debugging\n",
" if debug and n>3:\n",
" break\n",
" \n",
" # Create dataframe from rows\n",
" df = pd.DataFrame(rows)\n",
" avg_profile = df.groupby('x').agg({'z': [np.nanmean, np.nanstd]}).reset_index()\n",
"\n",
" return {\n",
" 'x': avg_profile.x.tolist(),\n",
" 'z': avg_profile.z.nanmean.tolist(),\n",
" 'std': avg_profile.z.nanstd.tolist(),\n",
" 'n': n+1 # number of profiles\n",
" }"
]
},
{
"cell_type": "markdown",
"metadata": {
"hidden": true
},
"source": [
"Now, let's look at whether there is a difference between the average beach profile of correctly forecasted site_ids and incorrectly forecasted site_ids. First, looking at sites where we observed swash regime."
]
},
{
"cell_type": "code",
"execution_count": 161,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-05T02:00:36.853374Z",
"start_time": "2018-12-05T01:58:21.839366Z"
},
"code_folding": [],
"hidden": true
},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>dune_toe_z</th>\n",
" <th>R_high</th>\n",
" <th>diff</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>AVOCAn0004</th>\n",
" <td>3.178</td>\n",
" <td>3.416988</td>\n",
" <td>0.238988</td>\n",
" </tr>\n",
" <tr>\n",
" <th>BOOM0004</th>\n",
" <td>3.065</td>\n",
" <td>3.074980</td>\n",
" <td>0.009980</td>\n",
" </tr>\n",
" <tr>\n",
" <th>BOOM0011</th>\n",
" <td>2.771</td>\n",
" <td>6.491824</td>\n",
" <td>3.720824</td>\n",
" </tr>\n",
" <tr>\n",
" <th>BOOM0012</th>\n",
" <td>2.796</td>\n",
" <td>3.148087</td>\n",
" <td>0.352087</td>\n",
" </tr>\n",
" <tr>\n",
" <th>CATHIE0001</th>\n",
" <td>2.780</td>\n",
" <td>3.522792</td>\n",
" <td>0.742792</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"application/vnd.jupyter.widget-view+json": {
"model_id": "03f2e99d20a347f3922a0e6a36f99ccd",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
" dune_toe_z R_high diff\n",
"AVOCAn0004 3.178 3.416988 0.238988\n",
"BOOM0004 3.065 3.074980 0.009980\n",
"BOOM0011 2.771 6.491824 3.720824\n",
"BOOM0012 2.796 3.148087 0.352087\n",
"CATHIE0001 2.780 3.522792 0.742792"
"FigureWidget({\n",
" 'data': [{'line': {'color': 'rgb(205, 0, 0)', 'width': 2},\n",
" 'mode': 'lines',\n",
" …"
]
},
"execution_count": 42,
"metadata": {},
"output_type": "execute_result"
"output_type": "display_data"
}
],
"source": [
"# Find site_ids where the forecast has been overpredicted\n",
"set1 = set(impacts['forecasted']['mean_slope_sto06'].query(\"storm_regime == 'collision'\").index.get_level_values('site_id'))\n",
"set2 = set(impacts['observed'].query(\"storm_regime == 'swash'\").index.get_level_values('site_id'))\n",
"site_ids = list(set1.intersection(set2))\n",
"overpredicted = get_avg_profile(swash_overpredicted_site_ids)\n",
"correct = get_avg_profile(swash_correct_site_ids)\n",
"\n",
"# Get dune toes at these sites and predicted max R_high\n",
"df_toes = df_profile_features.loc[site_ids].query('profile_type==\"prestorm\"').dune_toe_z\n",
"df_R_highs = twls['forecasted']['mean_slope_sto06'].loc[site_ids].groupby('site_id')['R_high'].max()\n",
"# Add mean profile\n",
"trace_overpredicted_mean = go.Scatter(\n",
" x=overpredicted['x'],\n",
" y=overpredicted['z'],\n",
" opacity=1,\n",
" mode='lines',\n",
" name='Mean overpredicted profile (n={})'.format(overpredicted['n']),\n",
" line=dict(\n",
" color=('rgb(205, 0, 0)'),\n",
" width=2)\n",
")\n",
"\n",
"# Join into one dataframe\n",
"df_twl_toes = pd.concat([df_toes, df_R_highs],axis=1,sort=True)\n",
"df_twl_toes['diff'] = df_twl_toes['R_high'] - df_twl_toes['dune_toe_z']\n",
"df_twl_toes.head()\n"
"trace_overpredited_std_top = go.Scatter(\n",
" x=overpredicted['x'],\n",
" y=np.add(overpredicted['z'], overpredicted['std']),\n",
" opacity=1,\n",
" hoverinfo='none',\n",
" showlegend=False,\n",
" mode='lines',\n",
" line=dict(\n",
" color=('rgb(205, 0, 0)'),\n",
" width=0.5,\n",
" dash='dash')\n",
")\n",
"\n",
"trace_overpredited_std_btm = go.Scatter(\n",
" x=overpredicted['x'],\n",
" y=np.subtract(overpredicted['z'], overpredicted['std']),\n",
" opacity=1,\n",
" hoverinfo='none',\n",
" mode='lines',\n",
" showlegend=False,\n",
" line=dict(\n",
" color=('rgb(205, 0, 0)'),\n",
" width=0.5,\n",
" dash='dash')\n",
")\n",
"\n",
"trace_correct_mean = go.Scatter(\n",
" x=avg_correct_x,\n",
" y=avg_correct_z,\n",
" opacity=1,\n",
" mode='lines',\n",
" name='Mean correct profile (n={})'.format(correct['n']),\n",
" line=dict(\n",
" color=('rgb(0, 205, 0)'),\n",
" width=2)\n",
")\n",
"\n",
"trace_correct_std_top = go.Scatter(\n",
" x=avg_correct_x,\n",
" y=np.add(avg_correct_z, avg_correct_std),\n",
" opacity=1,\n",
" hoverinfo='none',\n",
" showlegend=False,\n",
" mode='lines',\n",
" line=dict(\n",
" color=('rgb(0, 205, 0)'),\n",
" width=0.5,\n",
" dash='dash')\n",
")\n",
"\n",
"trace_correct_std_btm = go.Scatter(\n",
" x=avg_correct_x,\n",
" y=np.subtract(avg_correct_z, avg_correct_std),\n",
" opacity=1,\n",
" hoverinfo='none',\n",
" mode='lines',\n",
" showlegend=False,\n",
" line=dict(\n",
" color=('rgb(0, 205, 0)'),\n",
" width=0.5,\n",
" dash='dash')\n",
")\n",
"\n",
"layout = dict(showlegend=True,\n",
" title='Observed Swash Impact Regime',\n",
" legend=dict(x=.6, y=1),\n",
" xaxis=dict(\n",
" range=[-150, 0]),\n",
" yaxis=dict(\n",
" range=[0, 10]))\n",
"\n",
"fig = go.FigureWidget(data=[trace_overpredicted_mean,\n",
" trace_overpredited_std_top,\n",
" trace_overpredited_std_btm,\n",
" trace_correct_mean,\n",
" trace_correct_std_top,\n",
" trace_correct_std_btm],\n",
" layout=layout)\n",
"\n",
"# To output to file\n",
"img_bytes = pio.write_image(\n",
" fig, 'mean_profiles_swash.png', format='png', width=600, height=600, scale=5)\n",
"\n",
"fig"
]
},
{
"cell_type": "markdown",
"metadata": {
"hidden": true
},
"source": [
"We can see that the difference is pretty minimal. For cases where we predicted collision, but observed swash (overprediction), we see that overpredicted profiles are slightly more concave than correctly predicted sites."
]
},
{
"cell_type": "code",
"execution_count": 47,
"execution_count": 162,
"metadata": {
"ExecuteTime": {
"end_time": "2018-12-03T04:14:46.601092Z",
"start_time": "2018-12-03T04:14:46.522883Z"
}
"end_time": "2018-12-05T02:03:38.394415Z",
"start_time": "2018-12-05T02:00:37.335377Z"
},
"hidden": true
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "3ea49a4ac07c4ea19bbb4532326ff94c",
"model_id": "1255bccc024e4690b4b8ff4ccc8e9e35",
"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': [{'type': 'histogram',\n",
" 'uid': '4a284474-2be1-4fd7-87d5-25364cc78df4',\n",
" 'y': [0.23898814460475037, 0.009980312001434566, 3.720823710344608,\n",
" ..., 1.5720238663972683, 0.912998680585452, 1.1419977620500927]}],\n",
" 'layout': {'bargap': 0.2,\n",
" 'bargroupgap': 0.1,\n",
" 'title': 'D_low - R_high<br>Observed Swash, Forecasted Collision',\n",
" 'xaxis': {'title': 'Count'},\n",
" 'yaxis': {'title': 'z (m AHD)'}}\n",
"})"
" 'data': [{'line': {'color': 'rgb(205, 0, 0)', 'width': 2},\n",
" 'mode': 'lines',\n",
" …"
]
},
"metadata": {},
@ -474,29 +600,114 @@
}
],
"source": [
"trace1 = go.Histogram(y=df_twl_toes['diff'].tolist())\n",
"underpredicted = get_avg_profile(collision_underpredicted_site_ids)\n",
"correct = get_avg_profile(collision_correct_site_ids)\n",
"\n",
"layout = go.Layout(\n",
" title='D_low - R_high<br>Observed Swash, Forecasted Collision',\n",
" yaxis=dict(\n",
" title='z (m AHD)'\n",
" ),\n",
" xaxis=dict(\n",
" title='Count'\n",
" ),\n",
" bargap=0.2,\n",
" bargroupgap=0.1\n",
"# Add mean profile\n",
"trace_underpredicted_mean = go.Scatter(\n",
" x = underpredicted['x'],\n",
" y= underpredicted['z'],\n",
" opacity = 1,\n",
" mode='lines',\n",
" name='Mean underpredicted profile (n={})'.format(underpredicted['n']),\n",
" line = dict(\n",
" color = ('rgb(205, 0, 0)'),\n",
" width = 2)\n",
")\n",
"\n",
"g_plot = go.FigureWidget(data=[trace1], layout=layout)\n",
"g_plot"
"trace_underpredicted_std_top = go.Scatter(\n",
" x = underpredicted['x'],\n",
" y= np.add(underpredicted['z'],underpredicted['std']),\n",
" opacity = 1,\n",
" hoverinfo='none',\n",
" showlegend=False,\n",
" mode='lines',\n",
" line = dict(\n",
" color = ('rgb(205, 0, 0)'),\n",
" width = 0.5,\n",
" dash = 'dash')\n",
") \n",
"\n",
"trace_underpredicted_std_btm = go.Scatter(\n",
" x = underpredicted['x'],\n",
" y= np.subtract(underpredicted['z'],underpredicted['std']),\n",
" opacity = 1,\n",
" hoverinfo='none',\n",
" mode='lines',\n",
" showlegend=False,\n",
" line = dict(\n",
" color = ('rgb(205, 0, 0)'),\n",
" width = 0.5,\n",
" dash = 'dash')\n",
") \n",
"\n",
"trace_correct_mean = go.Scatter(\n",
" x = avg_correct_x,\n",
" y= avg_correct_z,\n",
" opacity = 1,\n",
" mode='lines',\n",
" name='Mean correct profile (n={})'.format(correct['n']),\n",
" line = dict(\n",
" color = ('rgb(0, 205, 0)'),\n",
" width = 2)\n",
")\n",
"\n",
"trace_correct_std_top = go.Scatter(\n",
" x = avg_correct_x,\n",
" y= np.add(avg_correct_z, avg_correct_std),\n",
" opacity = 1,\n",
" hoverinfo='none',\n",
" showlegend=False,\n",
" mode='lines',\n",
" line = dict(\n",
" color = ('rgb(0, 205, 0)'),\n",
" width = 0.5,\n",
" dash = 'dash')\n",
") \n",
"\n",
"trace_correct_std_btm = go.Scatter(\n",
" x = avg_correct_x,\n",
" y= np.subtract(avg_correct_z, avg_correct_std),\n",
" opacity = 1,\n",
" hoverinfo='none',\n",
" mode='lines',\n",
" showlegend=False,\n",
" line = dict(\n",
" color = ('rgb(0, 205, 0)'),\n",
" width = 0.5,\n",
" dash = 'dash')\n",
") \n",
" \n",
"layout = dict(showlegend=True,\n",
" title='Observed Collision Impact Regime',\n",
" legend=dict(x=.6, y=1),\n",
" xaxis=dict(\n",
" range=[-150,0]),\n",
" yaxis=dict(\n",
" range=[0,10]))\n",
" \n",
"fig=go.FigureWidget(data=[trace_underpredicted_mean, \n",
" trace_underpredicted_std_top,\n",
" trace_underpredicted_std_btm, \n",
" trace_correct_mean, \n",
" trace_correct_std_top, \n",
" trace_correct_std_btm], \n",
" layout=layout)\n",
"\n",
"# To output to file\n",
"img_bytes = pio.write_image(fig, 'mean_profiles_collision.png',format='png', width=600, height=600, scale=5)\n",
"\n",
"fig\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"metadata": {
"hidden": true
},
"source": [
"The errors when we forecast collision but observe swash are much greater than we we forecast swash and observe collision. For this case, errors in excess of 1.0 m common. Why is this?"
"This plot is a bit more interesting. It shows that we are correctly forecasting collision when the profile is more accreted/convex, but when the profile is more eroded/concave, the water level is underpredicted. Why is this? "
]
}
],
@ -506,6 +717,18 @@
"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.7"
},
"toc": {
"base_numbering": 1,
"nav_menu": {},
@ -515,9 +738,14 @@
"title_cell": "Table of Contents",
"title_sidebar": "Contents",
"toc_cell": false,
"toc_position": {},
"toc_position": {
"height": "calc(100% - 180px)",
"left": "10px",
"top": "150px",
"width": "232.391px"
},
"toc_section_display": true,
"toc_window_display": false
"toc_window_display": true
},
"varInspector": {
"cols": {

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save