{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Data exploration\n", "This notebook provides an example how the data has been loaded and accessed for further analysis." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "ExecuteTime": { "end_time": "2018-12-03T23:02:22.927101Z", "start_time": "2018-12-03T23:02:22.612233Z" } }, "outputs": [], "source": [ "# Enable autoreloading of our modules. \n", "# Most of the code will be located in the /src/ folder, \n", "# and then called from the notebook.\n", "%matplotlib inline\n", "%reload_ext autoreload\n", "%autoreload" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "ExecuteTime": { "end_time": "2018-12-03T23:02:24.527369Z", "start_time": "2018-12-03T23:02:22.929088Z" }, "scrolled": true }, "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\n", "\n", "\n", "import matplotlib\n", "from matplotlib import cm\n", "import colorlover as cl\n", "\n", "from ipywidgets import widgets, Output\n", "from IPython.display import display, clear_output, Image, HTML\n", "\n", "from sklearn.metrics import confusion_matrix" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Import our data into pandas Dataframes for the analysis. Data files are `.csv` files which are stored in the `./data/interim/` folder." ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "ExecuteTime": { "end_time": "2018-12-03T23:02:39.868010Z", "start_time": "2018-12-03T23:02:24.529339Z" }, "pixiedust": { "displayParams": {} }, "scrolled": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Importing waves.csv\n", "Importing tides.csv\n", "Importing profiles.csv\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "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" ] }, { "name": "stdout", "output_type": "stream", "text": [ "Importing sites.csv\n", "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_waves = df_from_csv('waves.csv', index_col=[0, 1])\n", "df_tides = df_from_csv('tides.csv', index_col=[0, 1])\n", "df_profiles = df_from_csv('profiles.csv', index_col=[0, 1, 2])\n", "df_sites = df_from_csv('sites.csv', index_col=[0])\n", "df_profile_features = df_from_csv('profile_features.csv', index_col=[0])\n", "\n", "# Note that the forecasted data sets should be in the same order for impacts and twls\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", "\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", "print('Done!')" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2018-11-27T23:02:57.631306Z", "start_time": "2018-11-27T23:02:57.615263Z" } }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": { "hide_input": true }, "source": [ "The following interactive data explorer displays information on a per `site_id` basis. It can be used to examine pre/post storm cross-sections, water level time series and observed/predicted storm impacts." ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "ExecuteTime": { "end_time": "2018-12-05T03:57:14.533063Z", "start_time": "2018-12-05T03:57:13.745017Z" }, "code_folding": [ 408 ], "hide_input": false, "scrolled": false }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "eae0e9440a5f45599b2c9b43352d3d13", "version_major": 2, "version_minor": 0 }, "text/plain": [ "VBox(children=(VBox(children=(HTML(value='Filter by observed and predicted impacts:'), HBox(children=(V…" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Create widgets for filtering by observed and forecasted impacts\n", "filter_title = widgets.HTML(\n", " value=\"Filter by observed and predicted impacts:\", )\n", "\n", "titles = ['Observed Impacts']\n", "selectboxes = [\n", " widgets.SelectMultiple(\n", " options=impacts['observed'].storm_regime.dropna().unique().tolist(),\n", " value=impacts['observed'].storm_regime.dropna().unique().tolist(),\n", " disabled=False)\n", "]\n", "\n", "# Iterate through each of our forecasted impacts\n", "for forecast in impacts['forecasted']:\n", " selectboxes.append(\n", " widgets.SelectMultiple(\n", " options=impacts['forecasted'][\n", " forecast].storm_regime.dropna().unique().tolist(),\n", " value=impacts['forecasted'][forecast].storm_regime.dropna()\n", " .unique().tolist(),\n", " disabled=False))\n", " titles.append('Forecasted: {}'.format(forecast))\n", "\n", "titles = [widgets.HTML(value=title) for title in titles]\n", "\n", "children = widgets.HBox(children=[\n", " widgets.VBox(children=[title, box])\n", " for title, box in zip(titles, selectboxes)\n", "])\n", "filter_container = widgets.VBox(children=[filter_title, children])\n", "\n", "# Create widgets for selecting site_id\n", "site_id_title = widgets.HTML(value=\"Filter by site_id:\", )\n", "\n", "site_id_select = widgets.Dropdown(\n", " description='site_id: ',\n", " value='NARRA0001',\n", " options=df_profiles.index.get_level_values('site_id').unique()\n", " .sort_values().tolist())\n", "\n", "site_id_impacts = widgets.HTML(value=\"\", )\n", "\n", "site_id_container = widgets.HBox(children=[\n", " widgets.VBox(\n", " children=[site_id_title,\n", " widgets.HBox(children=[site_id_select])]), site_id_impacts\n", "])\n", "\n", "# Build colors for each of our forecasts\n", "colors = list(\n", " reversed(cl.scales[str(max(len(impacts['forecasted']),\n", " 3))]['seq']['YlGnBu']))\n", "\n", "# Add panel for pre/post storm profiles\n", "trace1 = go.Scatter(\n", " x=[0],\n", " y=[0],\n", " name='Pre Storm Profile',\n", " line=dict(color=('rgb(51,160,44)'), width=2))\n", "trace2 = go.Scatter(\n", " x=[0],\n", " y=[0],\n", " name='Post Storm Profile',\n", " line=dict(color=('rgb(255,127,0)'), width=2))\n", "trace3 = go.Scatter(\n", " x=[0],\n", " y=[0],\n", " name='Pre-storm dune crest',\n", " mode='markers',\n", " marker=dict(\n", " color='rgba(255,255,255,0)',\n", " size=10,\n", " line=dict(color='rgba(106,61,154, 1)', width=2)),\n", ")\n", "trace4 = go.Scatter(\n", " x=[0],\n", " y=[0],\n", " name='Pre-storm dune toe',\n", " mode='markers',\n", " marker=dict(\n", " color='rgba(255,255,255,0)',\n", " size=10,\n", " line=dict(color='rgba(202,178,214,1)', width=2)),\n", ")\n", "\n", "trace5 = go.Scatter(\n", " x=[0],\n", " y=[0],\n", " name='Post-storm dune crest',\n", " mode='markers',\n", " marker=dict(\n", " color='rgba(255,255,255,0)',\n", " size=10,\n", " line=dict(color='rgba(106,61,154, 1)', width=2),\n", " symbol='square'),\n", ")\n", "trace6 = go.Scatter(\n", " x=[0],\n", " y=[0],\n", " name='Post-storm dune toe',\n", " mode='markers',\n", " marker=dict(\n", " color='rgba(255,255,255,0)',\n", " size=10,\n", " line=dict(color='rgba(202,178,214,1)', width=2),\n", " symbol='square'),\n", ")\n", "\n", "\n", "forecast_traces = []\n", "for forecast, color in zip(impacts['forecasted'], colors):\n", " forecast_traces.append(\n", " go.Scatter(\n", " x=[0],\n", " y=[0],\n", " name='Peak R_high: {}'.format(forecast),\n", " mode='lines',\n", " line=dict(\n", " color=color,\n", " width=4,\n", " )))\n", "\n", "layout = go.Layout(\n", " title='Bed Profiles',\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='x (m)',\n", " autorange=True,\n", " showgrid=True,\n", " zeroline=True,\n", " showline=True,\n", " range=[0, 200]),\n", " yaxis=dict(\n", " title='z (m)',\n", " autorange=False,\n", " showgrid=True,\n", " zeroline=True,\n", " showline=True,\n", " range=[-1, 20]))\n", "\n", "g_profiles = go.FigureWidget(\n", " data=[trace1, trace2, trace3, trace4, trace5, trace6] + forecast_traces, layout=layout)\n", "\n", "# Add panel for google maps\n", "mapbox_access_token = 'pk.eyJ1IjoiY2hyaXNsZWFtYW4iLCJhIjoiY2pvNTY1MzZpMDc2OTN2bmw5MGsycHp5bCJ9.U2dwFg2c7RFjUNSayERUiw'\n", "\n", "data = [\n", " go.Scattermapbox(\n", " lat=df_sites['lat'],\n", " lon=df_sites['lon'],\n", " mode='markers',\n", " marker=dict(size=10),\n", " text=df_sites.index.get_level_values('site_id'),\n", " ),\n", " go.Scattermapbox(\n", " lat=[0],\n", " lon=[0],\n", " mode='markers',\n", " marker=dict(\n", " size=20,\n", " color='rgb(255, 0, 0)',\n", " opacity=0.5,\n", " ),\n", " text=df_sites.index.get_level_values('site_id'),\n", " ),\n", "]\n", "\n", "layout = go.Layout(\n", " autosize=True,\n", " height=300,\n", " hovermode='closest',\n", " showlegend=False,\n", " margin=dict(t=50, b=50, l=20, r=20),\n", " mapbox=dict(\n", " accesstoken=mapbox_access_token,\n", " bearing=0,\n", " center=dict(lat=-33.7, lon=151.3),\n", " pitch=0,\n", " zoom=12,\n", " style='satellite-streets'),\n", ")\n", "\n", "fig = dict(data=data, layout=layout)\n", "g_map = go.FigureWidget(data=data, layout=layout)\n", "\n", "subplot = tls.make_subplots(3, 1, print_grid=False, shared_xaxes=True)\n", "g_timeseries = go.FigureWidget(subplot)\n", "\n", "# Add trace for Hs0\n", "g_timeseries.add_trace(\n", " go.Scatter(\n", " x=[0, 1],\n", " y=[0, 1],\n", " name='Hs0',\n", " ),\n", " row=3,\n", " col=1,\n", ")\n", "\n", "# Add trace for Tp\n", "g_timeseries.add_trace(\n", " go.Scatter(\n", " x=[0, 1],\n", " y=[0, 1],\n", " name='Tp',\n", " ),\n", " row=3,\n", " col=1,\n", ")\n", "\n", "# Add water levels\n", "g_timeseries.add_trace(\n", " go.Scatter(\n", " x=[0, 3],\n", " y=[0, 3],\n", " name='Dune Crest',\n", " mode='lines',\n", " line=dict(color=('rgb(214, 117, 14)'), width=2, dash='dot')),\n", " row=1,\n", " col=1)\n", "\n", "g_timeseries.add_trace(\n", " go.Scatter(\n", " x=[0, 3],\n", " y=[0, 3],\n", " name='Dune Toe',\n", " mode='lines',\n", " line=dict(color=('rgb(142, 77, 8)'), width=2, dash='dash')),\n", " row=1,\n", " col=1)\n", "\n", "g_timeseries.add_trace(\n", " go.Scatter(\n", " x=[0, 3],\n", " y=[0, 3],\n", " name='Tide+Surge WL',\n", " line=dict(color=('rgb(8,51,137)'), width=2, dash='dot')),\n", " row=1,\n", " col=1)\n", "\n", "for forecast, color in zip(twls['forecasted'], colors):\n", " g_timeseries.add_trace(\n", " go.Scatter(\n", " x=[0],\n", " y=[0],\n", " name='R_high: {}'.format(forecast),\n", " line=dict(color=color, width=3)),\n", " row=1,\n", " col=1)\n", "\n", "# Add trace for each forecasted beta term\n", "for forecast, color in zip(impacts['forecasted'], colors):\n", " g_timeseries.add_trace(\n", " go.Scatter(\n", " x=[0, 1],\n", " y=[0, 1],\n", " name='Beta: {}'.format(forecast),\n", " line=dict(color=color, width=3)),\n", " row=2,\n", " col=1,\n", " )\n", "\n", "# Create axis for Tp on same plot as Hs\n", "g_timeseries['layout']['yaxis4'] = {'overlaying': 'y3', 'side': 'right'}\n", "g_timeseries.data[1]['yaxis'] = 'y4'\n", "\n", "# Add labels to each axis\n", "g_timeseries.layout['xaxis']['title'] = 'datetime'\n", "g_timeseries.layout['yaxis1']['title'] = 'z (mAHD)'\n", "g_timeseries.layout['yaxis2']['title'] = 'beta (-)'\n", "g_timeseries.layout['yaxis3']['title'] = 'Hs0 (m)'\n", "g_timeseries.layout['yaxis4']['title'] = 'Tp (s)'\n", "\n", "# Update figure size\n", "g_timeseries['layout'].update(height=400, legend=dict(font={'size': 10}))\n", "g_timeseries['layout'].update(margin=dict(t=20, l=50, r=20, b=100))\n", "\n", "# Add panel for some tables\n", "titles = ['observed'] + [forecast for forecast in impacts['forecasted']]\n", "titles = [widgets.HTML(value=\"{}\".format(title)) for title in titles]\n", "\n", "\n", "def get_observed_impacts_table(site_id):\n", " display(impacts['observed'].query(\"site_id=='{}'\".format(site_id)).T)\n", "\n", "\n", "def get_forecasted_impacts_table(site_id, forecast):\n", " display(impacts['forecasted'][forecast].query(\n", " \"site_id=='{}'\".format(site_id)).T)\n", "\n", "\n", "impacts_table_observed = widgets.interactive_output(\n", " get_observed_impacts_table, {'site_id': site_id_select})\n", "forecasted_impacts_tables = []\n", "for forecast, title in zip(impacts['forecasted'], titles[1:]):\n", " forecasted_impacts_tables.append(\n", " widgets.interactive_output(get_forecasted_impacts_table, {\n", " 'site_id': site_id_select,\n", " 'forecast': title\n", " }))\n", "\n", "tables = [impacts_table_observed] + forecasted_impacts_tables\n", "\n", "title_tables = [\n", " widgets.VBox(children=[title, table])\n", " for title, table in zip(titles, tables)\n", "]\n", "\n", "tables_container = widgets.HBox(children=[*title_tables])\n", "\n", "\n", "def update_profile(change):\n", "\n", " site_id = site_id_select.value\n", "\n", " if site_id is None:\n", " return\n", "\n", " site_profile = df_profiles.query('site_id == \"{}\"'.format(site_id))\n", " prestorm_profile = site_profile.query('profile_type == \"prestorm\"')\n", " poststorm_profile = site_profile.query('profile_type == \"poststorm\"')\n", "\n", " poststorm_x = poststorm_profile.index.get_level_values('x').tolist()\n", " poststorm_z = poststorm_profile.z.tolist()\n", "\n", " prestorm_x = prestorm_profile.index.get_level_values('x').tolist()\n", " prestorm_z = prestorm_profile.z.tolist()\n", "\n", " prestorm_site_features = df_profile_features.query(\n", " 'site_id == \"{}\" and profile_type==\"prestorm\"'.format(site_id))\n", " prestorm_dune_crest_x = prestorm_site_features.dune_crest_x\n", " prestorm_dune_crest_z = prestorm_site_features.dune_crest_z\n", " prestorm_dune_toe_x = prestorm_site_features.dune_toe_x\n", " prestorm_dune_toe_z = prestorm_site_features.dune_toe_z\n", "\n", " \n", " poststorm_site_features = df_profile_features.query(\n", " 'site_id == \"{}\" and profile_type==\"poststorm\"'.format(site_id))\n", " poststorm_dune_crest_x = poststorm_site_features.dune_crest_x\n", " poststorm_dune_crest_z = poststorm_site_features.dune_crest_z\n", " poststorm_dune_toe_x = poststorm_site_features.dune_toe_x\n", " poststorm_dune_toe_z = poststorm_site_features.dune_toe_z\n", " \n", " # Update beach profile section plots\n", " with g_profiles.batch_update():\n", " g_profiles.data[0].x = prestorm_x\n", " g_profiles.data[0].y = prestorm_z\n", " g_profiles.data[1].x = poststorm_x\n", " g_profiles.data[1].y = poststorm_z\n", " g_profiles.data[2].x = prestorm_dune_crest_x\n", " g_profiles.data[2].y = prestorm_dune_crest_z\n", " g_profiles.data[3].x = prestorm_dune_toe_x\n", " g_profiles.data[3].y = prestorm_dune_toe_z\n", " g_profiles.data[4].x = poststorm_dune_crest_x\n", " g_profiles.data[4].y = poststorm_dune_crest_z\n", " g_profiles.data[5].x = poststorm_dune_toe_x\n", " g_profiles.data[5].y = poststorm_dune_toe_z\n", " \n", " for n, forecast in enumerate(impacts['forecasted']):\n", " R_high = max(impacts['forecasted'][forecast].query(\n", " \"site_id=='{}'\".format(site_id)).R_high)\n", " g_profiles.data[6 + n].x = [200, 400]\n", " g_profiles.data[6 + n].y = [R_high, R_high]\n", "\n", " # Relocate plan of satellite imagery\n", " site_coords = df_sites.query('site_id == \"{}\"'.format(site_id))\n", " with g_map.batch_update():\n", " g_map.layout.mapbox['center'] = {\n", " 'lat': site_coords['lat'].values[0],\n", " 'lon': site_coords['lon'].values[0]\n", " }\n", " g_map.layout.mapbox['zoom'] = 15\n", " g_map.data[1].lat = [site_coords['lat'].values[0]]\n", " g_map.data[1].lon = [site_coords['lon'].values[0]]\n", " g_map.data[1].text = site_coords['lon'].index.get_level_values(\n", " 'site_id').tolist()\n", "\n", " # Update time series plots\n", " df_waves_site = df_waves.query(\"site_id=='{}'\".format(site_id))\n", " times = df_waves_site.index.get_level_values('datetime').tolist()\n", " Hs0s = df_waves_site.Hs0.tolist()\n", " Tps = df_waves_site.Tp.tolist()\n", "\n", " df_tide_site = df_tides.query(\"site_id=='{}'\".format(site_id))\n", " mask = (df_tide_site.index.get_level_values('datetime') >= min(times)) & (\n", " df_tide_site.index.get_level_values('datetime') <= max(times))\n", " df_tide_site = df_tide_site.loc[mask]\n", "\n", " with g_timeseries.batch_update():\n", " g_timeseries.data[0].x = times\n", " g_timeseries.data[0].y = Hs0s\n", " g_timeseries.data[1].x = times\n", " g_timeseries.data[1].y = Tps\n", "\n", " # Update beta values\n", " idx_betas = [\n", " n for n, x in enumerate(g_timeseries.data) if 'Beta' in x.name\n", " ]\n", " for i, forecast in zip(idx_betas, twls['forecasted']):\n", " df_twl = twls['forecasted'][forecast].query(\n", " \"site_id=='{}'\".format(site_id))\n", " times = df_twl.index.get_level_values('datetime').tolist()\n", " beta = df_twl.beta.tolist()\n", " g_timeseries.data[i].x = times\n", " g_timeseries.data[i].y = beta\n", "\n", " g_timeseries.data[2].x = [min(times), max(times)]\n", " g_timeseries.data[3].x = [min(times), max(times)]\n", " g_timeseries.data[4].x = df_tide_site.index.get_level_values(\n", " 'datetime')\n", " g_timeseries.data[2].y = prestorm_dune_crest_z.tolist()[\n", " 0], prestorm_dune_crest_z.tolist()[0],\n", " g_timeseries.data[3].y = prestorm_dune_toe_z.tolist()[0], prestorm_dune_toe_z.tolist()[\n", " 0],\n", " g_timeseries.data[4].y = df_tide_site.tide.tolist()\n", "\n", " # Update rhigh values\n", " idx_betas = [\n", " n for n, x in enumerate(g_timeseries.data) if 'R_high' in x.name\n", " ]\n", " for i, forecast in zip(idx_betas, twls['forecasted']):\n", " df_twl = twls['forecasted'][forecast].query(\n", " \"site_id=='{}'\".format(site_id))\n", " times = df_twl.index.get_level_values('datetime').tolist()\n", " R_high = df_twl.R_high.tolist()\n", " g_timeseries.data[i].x = times\n", " g_timeseries.data[i].y = R_high\n", "\n", " # Update site id impacts\n", " observed_regime = impacts['observed'].query(\n", " \"site_id=='{}'\".format(site_id)).storm_regime.values[0]\n", " site_id_impacts.value = \"Observed: {}
\".format(\n", " observed_regime)\n", "\n", " for forecast in impacts['forecasted']:\n", " regime = impacts['forecasted'][forecast].query(\n", " \"site_id=='{}'\".format(site_id)).storm_regime.values[0]\n", " site_id_impacts.value += '{}: {}
'.format(\n", " forecast, regime)\n", "\n", "\n", "site_id_select.observe(update_profile, names=\"value\")\n", "\n", "\n", "def update_filter(change):\n", "\n", " # Iterate through each box, only keeping site_ids which are not filtered out by each box\n", " valid_site_ids = impacts['observed'].index.tolist()\n", " dfs = [impacts['observed']\n", " ] + [impacts['forecasted'][key] for key in impacts['forecasted']]\n", "\n", " for box, df in zip(selectboxes, dfs):\n", " valid_site_ids = list(\n", " set(valid_site_ids).intersection(\n", " set(df[df.storm_regime.isin(box.value)].index.tolist())))\n", " site_id_select.options = sorted(valid_site_ids)\n", "\n", " # TODO Update options in selectboxes with number of observations?\n", "\n", "\n", "# Update the filter if any of the boxes changes\n", "for box in selectboxes:\n", " box.observe(update_filter, names=\"value\")\n", "\n", "# Display our widgets!\n", "widgets.VBox([\n", " filter_container, site_id_container,\n", " widgets.HBox([g_profiles, g_map]), g_timeseries, tables_container\n", "])" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "ExecuteTime": { "end_time": "2018-11-27T23:06:31.686277Z", "start_time": "2018-11-27T23:06:31.665206Z" } }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": { "ExecuteTime": { "end_time": "2018-11-22T22:52:36.039701Z", "start_time": "2018-11-22T22:52:36.035189Z" }, "hide_input": true, "scrolled": true }, "source": [ "This visualization looks at how well the storm impact predictions performed. " ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "ExecuteTime": { "end_time": "2018-12-03T23:02:42.021445Z", "start_time": "2018-12-03T23:02:41.468637Z" }, "code_folding": [], "hide_input": false, "scrolled": false }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "a2b52c5ad861454db1756a427f13b55d", "version_major": 2, "version_minor": 0 }, "text/plain": [ "VBox(children=(VBox(children=(HTML(value='Filter by beach:'), SelectMultiple(index=(0, 1, 2, 3, 4, 5, 6…" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Create colorscale\n", "rdylgr_cmap = matplotlib.cm.get_cmap('RdYlGn')\n", "\n", "norm = matplotlib.colors.Normalize(vmin=0, vmax=255)\n", "\n", "def matplotlib_to_plotly(cmap, pl_entries):\n", " h = 1.0/(pl_entries-1)\n", " pl_colorscale = []\n", "\n", " for k in range(pl_entries):\n", " C = list(map(np.uint8, np.array(cmap(k*h)[:3])*255))\n", " pl_colorscale.append([k*h, 'rgb'+str((C[0], C[1], C[2]))])\n", "\n", " return pl_colorscale\n", "\n", "rdylgr = matplotlib_to_plotly(rdylgr_cmap, 255)\n", "\n", "\n", "\n", "# Create widget for list of beaches.\n", "beaches = df_sites.beach.unique().tolist()\n", "\n", "beach_title = widgets.HTML(value=\"Filter by beach:\", )\n", "\n", "beach_select = widgets.SelectMultiple(\n", " options=beaches, value=beaches, disabled=False)\n", "\n", "beach_container = widgets.VBox([beach_title, beach_select])\n", "\n", "# Create confusion matrix for each forecasted impact data set\n", "heatmaps = []\n", "for forecast in impacts['forecasted']:\n", "\n", " z = [[.1, .3, .5, 2], [1.0, .8, .6, 1], [1.4, .28, 1.6, .21],\n", " [.6, .4, .2, 3]]\n", "\n", " x = ['swash', 'collision', 'overwash', 'inundation']\n", " y = list(reversed(x))\n", "\n", " z_text = z\n", "\n", " fig = ff.create_annotated_heatmap(z, x=x, y=y, annotation_text=z_text, colorscale=rdylgr)\n", " heatmap = go.FigureWidget(data=fig.data, layout=fig.layout)\n", "\n", " heatmap.layout.update(\n", " height=300, margin=go.layout.Margin(l=100, r=100, b=40, t=40, pad=0))\n", " heatmap.layout.xaxis.update(title='Predicted')\n", " heatmap.layout.yaxis.update(title='Observed')\n", " heatmap_title = widgets.HTML(value=\"{}\".format(forecast) )\n", " heatmaps.append(widgets.VBox([heatmap_title, heatmap]))\n", "\n", " \n", "def update_heatmaps(change):\n", " \n", " for forecast, heatmap in zip(impacts['forecasted'], heatmaps):\n", " selected_site_ids = df_sites[df_sites.beach.isin(beach_select.value)].index.tolist()\n", "\n", " df_ob = impacts['observed']\n", " df_fo = impacts['forecasted'][forecast]\n", "\n", " observed_regimes = df_ob[df_ob.index.isin(selected_site_ids)].storm_regime.dropna().rename(\"observed_regime\")\n", " forecasted_regimes = df_fo[df_fo.index.isin(selected_site_ids)].storm_regime.dropna().rename(\"forecasted_regime\")\n", "\n", " if any([observed_regimes.empty, forecasted_regimes.empty]):\n", " return\n", " \n", " df_compare = pd.concat([observed_regimes, forecasted_regimes], axis='columns', names=['a','b'], sort=True)\n", " df_compare.dropna(axis='index',inplace=True)\n", "\n", " z = confusion_matrix(df_compare.observed_regime.tolist(), df_compare.forecasted_regime.tolist(), labels = ['swash','collision','overwash','inundation'])\n", " z = np.flip(z,axis=0)\n", " z_list = list(reversed(z.tolist()))\n", " \n", " # Make incorrect values negative, so they get assigned a different color.\n", " # Better for visualization\n", " z_neg_incorrect = np.flip(np.identity(4),axis=0)\n", " z_neg_incorrect[z_neg_incorrect==0]= -1\n", " z_neg_incorrect = (z * z_neg_incorrect).tolist()\n", " \n", " # Also want to display percentages\n", " z_with_pct = []\n", " for row in z:\n", " new_row = []\n", " for val in row:\n", " new_row.append('{}
({}%)'.format(val, np.around(val/np.sum(z)*100,1)))\n", " z_with_pct.append(new_row)\n", " \n", " fig = ff.create_annotated_heatmap(z_neg_incorrect, x=x, y=y, annotation_text=z_with_pct)\n", " heatmap.children[1].data[0].z = z_neg_incorrect\n", " heatmap.children[1].layout.annotations = fig.layout.annotations\n", "\n", "# Hook changes to beach filter to update confusion heatmaps\n", "beach_select.observe(update_heatmaps, names=\"value\")\n", "\n", "# Display our widgets\n", "widgets.VBox([beach_container, widgets.VBox(heatmaps)])\n", "\n" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "ExecuteTime": { "end_time": "2018-12-03T23:03:48.457193Z", "start_time": "2018-12-03T23:03:48.274709Z" } }, "outputs": [], "source": [ "# To output to file\n", "# fig = heatmaps[1].children[1]\n", "# img_bytes = pio.write_image(fig, 'fig1.png',format='png', width=600, height=400, scale=5)\n", "\n", "# fig = g_profiles\n", "# img_bytes = pio.write_image(fig, 'fig1.png',format='png', width=600, height=200, scale=5)\n" ] }, { "cell_type": "markdown", "metadata": { "ExecuteTime": { "end_time": "2018-12-03T23:02:47.179180Z", "start_time": "2018-12-03T23:02:46.367273Z" } }, "source": [ "### Look at time dependance" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "ExecuteTime": { "end_time": "2018-12-03T23:49:16.581105Z", "start_time": "2018-12-03T23:49:16.274275Z" } }, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "8a366d02e4564347a5950b0f24c86363", "version_major": 2, "version_minor": 0 }, "text/plain": [ "VBox(children=(HBox(children=(VBox(children=(HTML(value='Filter by site_id:'), HBox(children=(Dropdown(…" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "# Create widgets for selecting site_id\n", "site_id_title = widgets.HTML(value=\"Filter by site_id:\", )\n", "\n", "site_id_select = widgets.Dropdown(\n", " description='site_id: ',\n", " value='NARRA0001',\n", " options=df_profiles.index.get_level_values('site_id').unique()\n", " .sort_values().tolist())\n", "\n", "site_id_impacts = widgets.HTML(value=\"\", )\n", "\n", "site_id_container = widgets.HBox(children=[\n", " widgets.VBox(\n", " children=[site_id_title,\n", " widgets.HBox(children=[site_id_select])]), site_id_impacts\n", "])\n", "\n", "\n", "# Plot profiles\n", "\n", "# Add panel for pre/post storm profiles\n", "trace1 = go.Scatter(\n", " x=[0],\n", " y=[0],\n", " name='Pre Storm Profile',\n", " line=dict(color=('rgb(51,160,44)'), width=2))\n", "trace2 = go.Scatter(\n", " x=[0],\n", " y=[0],\n", " name='Post Storm Profile',\n", " line=dict(color=('rgb(255,127,0)'), width=2))\n", "trace3 = go.Scatter(\n", " x=[0],\n", " y=[0],\n", " name='Pre-storm dune crest',\n", " mode='markers',\n", " marker=dict(\n", " color='rgba(255,255,255,0)',\n", " size=10,\n", " line=dict(color='rgba(106,61,154, 1)', width=2)),\n", ")\n", "trace4 = go.Scatter(\n", " x=[0],\n", " y=[0],\n", " name='Pre-storm dune toe',\n", " mode='markers',\n", " marker=dict(\n", " color='rgba(255,255,255,0)',\n", " size=10,\n", " line=dict(color='rgba(202,178,214,1)', width=2)),\n", ")\n", "\n", "trace5 = go.Scatter(\n", " x=[0],\n", " y=[0],\n", " name='Post-storm dune crest',\n", " mode='markers',\n", " marker=dict(\n", " color='rgba(255,255,255,0)',\n", " size=10,\n", " line=dict(color='rgba(106,61,154, 1)', width=2),\n", " symbol='square'),\n", ")\n", "trace6 = go.Scatter(\n", " x=[0],\n", " y=[0],\n", " name='Post-storm dune toe',\n", " mode='markers',\n", " marker=dict(\n", " color='rgba(255,255,255,0)',\n", " size=10,\n", " line=dict(color='rgba(202,178,214,1)', width=2),\n", " symbol='square'),\n", ")\n", "\n", "\n", "forecast_traces = []\n", "for forecast, color in zip(impacts['forecasted'], colors):\n", " forecast_traces.append(\n", " go.Scatter(\n", " x=[0],\n", " y=[0],\n", " name='Peak R_high: {}'.format(forecast),\n", " mode='lines',\n", " line=dict(\n", " color=color,\n", " width=4,\n", " )))\n", "\n", "layout = go.Layout(\n", " title='Bed Profiles',\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='x (m)',\n", " autorange=True,\n", " showgrid=True,\n", " zeroline=True,\n", " showline=True,\n", " range=[0, 200]),\n", " yaxis=dict(\n", " title='z (m)',\n", " autorange=False,\n", " showgrid=True,\n", " zeroline=True,\n", " showline=True,\n", " range=[-1, 20]))\n", "\n", "g_profiles = go.FigureWidget(\n", " data=[trace1, trace2, trace3, trace4, trace5, trace6] + forecast_traces, layout=layout)\n", "\n", "widgets.VBox([\n", " site_id_container,\n", " g_profiles\n", "])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Scatter plot" ] }, { "cell_type": "code", "execution_count": 30, "metadata": { "ExecuteTime": { "end_time": "2018-12-07T05:08:12.117885Z", "start_time": "2018-12-07T05:08:12.078780Z" } }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
prestorm_swash_volpoststorm_swash_volswash_vol_changeswash_pct_changeprestorm_dune_face_volpoststorm_dune_face_voldune_face_vol_changedune_face_pct_changestorm_regime
site_id
AVOCAn0001113.909177.983035.610331.2620165.4760166.72960.00000.0000swash
AVOCAn0002106.895967.091339.637337.0803256.4137258.91740.00000.0000swash
AVOCAn000399.048453.656345.162145.5960372.7031373.9198-0.3147-0.0844swash
AVOCAn000474.754329.328045.426260.7674275.1689276.04760.41040.1492swash
AVOCAn000570.596824.107146.489765.8524268.5194263.42627.41962.7631collision
AVOCAn000668.758323.966544.791865.1438202.6770198.23974.79442.3655collision
AVOCAn000775.789527.271548.518064.0168149.8479143.13127.13234.7597collision
AVOCAn000893.310742.496850.813954.4567187.9201187.34592.82971.5058collision
AVOCAn00093.69550.10383.591797.1908NaNNaNNaNNaNNaN
AVOCAs0001NaNNaNNaNNaNNaNNaNNaNNaNNaN
AVOCAs000297.386426.661970.724672.6226NaNNaNNaNNaNNaN
AVOCAs000370.740140.060830.791943.5282NaNNaNNaNNaNNaN
AVOCAs000497.838945.484552.215753.3691NaNNaNNaNNaNNaN
AVOCAs000595.171154.972240.170642.2088NaNNaNNaNNaNNaN
AVOCAs0006112.581867.871844.825239.8157NaNNaNNaNNaNNaN
AVOCAs000765.353144.153721.522832.9331NaNNaNNaNNaNNaN
AVOCAs000852.394044.91527.480314.2770NaNNaNNaNNaNNaN
BILG000119.41777.574611.843160.9913NaNNaNNaNNaNNaN
BILG0002155.699898.169357.434036.8876NaNNaNNaNNaNNaN
BILG000383.521952.805930.553736.581741.146940.60810.00000.0000swash
BILG0004158.6283116.618942.117826.551211.221111.0892-0.0132-0.1179swash
BILG0005212.8478164.004448.431222.7539613.6156606.27665.77380.9410collision
BLUEYS000165.462819.293846.169070.5270130.7447120.54469.56017.3121collision
BLUEYS000250.208410.300939.907479.4836512.0154477.177433.28256.5003collision
BLUEYS000350.630811.168239.462577.9418443.0853414.390124.88705.6167collision
BLUEYS000495.160831.333063.827967.0737287.5805272.426712.96414.5080collision
BLUEYS0005141.064358.254582.809858.7036539.3864520.073212.04702.2335collision
BLUEYS000688.420751.620536.255341.0032271.6036267.19543.60451.3271collision
BOAT000123.851023.5660-0.0264-0.1108NaNNaNNaNNaNNaN
BOAT000237.652414.020923.631662.7624NaNNaNNaNNaNNaN
..............................
TREACH001497.532346.299451.081652.3740508.7400505.78770.42540.0836swash
TREACH001596.832745.196251.636453.3254690.8275683.44581.50860.2184NaN
TREACH0016106.908366.056740.362937.7547508.0014499.63150.33860.0667swash
WAMBE0001132.3413143.4459-9.7255-7.3488665.9898667.59230.04100.0062swash
WAMBE0002151.1833126.984423.954815.8449385.8467386.7284-0.0449-0.0116swash
WAMBE0003154.1788117.944136.242523.5068694.2226700.5105-4.2136-0.6070swash
WAMBE0004137.844976.600761.272544.4503559.5485569.8591-4.4590-0.7969swash
WAMBE0005NaNNaNNaNNaNNaNNaNNaNNaNNaN
WAMBE0006205.8453186.078422.589210.973955.089855.89190.00000.0000swash
WAMBE000780.467435.461445.005955.9307178.1005178.54390.47270.2654swash
WAMBE000888.457440.320048.137454.4187258.7513258.3849-1.2073-0.4666swash
WAMBE000970.915926.174244.741863.0913267.3725258.37209.80413.6668collision
WAMBE001058.660418.041840.618669.2437187.5259161.974825.308713.4961collision
WAMBE001159.241516.316542.925072.4577197.0129175.251221.988211.1608collision
WAMBE001274.418923.023251.395769.0627178.4783168.347510.03865.6246collision
WAMBE001370.496422.754647.741967.7224231.1513195.258135.807215.4908collision
WAMBE001468.089624.185343.904364.480282.426861.260121.171825.6856collision
WAMBE001555.078016.011939.066070.9286NaNNaNNaNNaNNaN
WAMBE001696.768739.822456.946358.8479NaNNaNNaNNaNNaN
WAMBE001735.29878.514026.784775.8801NaNNaNNaNNaNNaN
WAMBE001840.940710.514730.426074.3173NaNNaNNaNNaNNaN
WAMBE001938.28389.215629.068275.9282NaNNaNNaNNaNNaN
WAMBE0020NaNNaNNaNNaNNaNNaNNaNNaNNaN
WAMBE0021NaNNaNNaNNaNNaNNaNNaNNaNNaN
WAMBE00220.55160.28400.267548.5063NaNNaNNaNNaNNaN
WAMBE00233.37610.30203.074191.0554NaNNaNNaNNaNNaN
WAMBE002460.864831.279429.585448.6084NaNNaNNaNNaNNaN
WAMBE002545.105514.602830.502867.6253NaNNaNNaNNaNNaN
WAMBE002632.150212.933519.216759.7716NaNNaNNaNNaNNaN
WAMBE002726.231018.68287.548228.7759NaNNaNNaNNaNNaN
\n", "

1768 rows × 9 columns

\n", "
" ], "text/plain": [ " prestorm_swash_vol poststorm_swash_vol swash_vol_change \\\n", "site_id \n", "AVOCAn0001 113.9091 77.9830 35.6103 \n", "AVOCAn0002 106.8959 67.0913 39.6373 \n", "AVOCAn0003 99.0484 53.6563 45.1621 \n", "AVOCAn0004 74.7543 29.3280 45.4262 \n", "AVOCAn0005 70.5968 24.1071 46.4897 \n", "AVOCAn0006 68.7583 23.9665 44.7918 \n", "AVOCAn0007 75.7895 27.2715 48.5180 \n", "AVOCAn0008 93.3107 42.4968 50.8139 \n", "AVOCAn0009 3.6955 0.1038 3.5917 \n", "AVOCAs0001 NaN NaN NaN \n", "AVOCAs0002 97.3864 26.6619 70.7246 \n", "AVOCAs0003 70.7401 40.0608 30.7919 \n", "AVOCAs0004 97.8389 45.4845 52.2157 \n", "AVOCAs0005 95.1711 54.9722 40.1706 \n", "AVOCAs0006 112.5818 67.8718 44.8252 \n", "AVOCAs0007 65.3531 44.1537 21.5228 \n", "AVOCAs0008 52.3940 44.9152 7.4803 \n", "BILG0001 19.4177 7.5746 11.8431 \n", "BILG0002 155.6998 98.1693 57.4340 \n", "BILG0003 83.5219 52.8059 30.5537 \n", "BILG0004 158.6283 116.6189 42.1178 \n", "BILG0005 212.8478 164.0044 48.4312 \n", "BLUEYS0001 65.4628 19.2938 46.1690 \n", "BLUEYS0002 50.2084 10.3009 39.9074 \n", "BLUEYS0003 50.6308 11.1682 39.4625 \n", "BLUEYS0004 95.1608 31.3330 63.8279 \n", "BLUEYS0005 141.0643 58.2545 82.8098 \n", "BLUEYS0006 88.4207 51.6205 36.2553 \n", "BOAT0001 23.8510 23.5660 -0.0264 \n", "BOAT0002 37.6524 14.0209 23.6316 \n", "... ... ... ... \n", "TREACH0014 97.5323 46.2994 51.0816 \n", "TREACH0015 96.8327 45.1962 51.6364 \n", "TREACH0016 106.9083 66.0567 40.3629 \n", "WAMBE0001 132.3413 143.4459 -9.7255 \n", "WAMBE0002 151.1833 126.9844 23.9548 \n", "WAMBE0003 154.1788 117.9441 36.2425 \n", "WAMBE0004 137.8449 76.6007 61.2725 \n", "WAMBE0005 NaN NaN NaN \n", "WAMBE0006 205.8453 186.0784 22.5892 \n", "WAMBE0007 80.4674 35.4614 45.0059 \n", "WAMBE0008 88.4574 40.3200 48.1374 \n", "WAMBE0009 70.9159 26.1742 44.7418 \n", "WAMBE0010 58.6604 18.0418 40.6186 \n", "WAMBE0011 59.2415 16.3165 42.9250 \n", "WAMBE0012 74.4189 23.0232 51.3957 \n", "WAMBE0013 70.4964 22.7546 47.7419 \n", "WAMBE0014 68.0896 24.1853 43.9043 \n", "WAMBE0015 55.0780 16.0119 39.0660 \n", "WAMBE0016 96.7687 39.8224 56.9463 \n", "WAMBE0017 35.2987 8.5140 26.7847 \n", "WAMBE0018 40.9407 10.5147 30.4260 \n", "WAMBE0019 38.2838 9.2156 29.0682 \n", "WAMBE0020 NaN NaN NaN \n", "WAMBE0021 NaN NaN NaN \n", "WAMBE0022 0.5516 0.2840 0.2675 \n", "WAMBE0023 3.3761 0.3020 3.0741 \n", "WAMBE0024 60.8648 31.2794 29.5854 \n", "WAMBE0025 45.1055 14.6028 30.5028 \n", "WAMBE0026 32.1502 12.9335 19.2167 \n", "WAMBE0027 26.2310 18.6828 7.5482 \n", "\n", " swash_pct_change prestorm_dune_face_vol poststorm_dune_face_vol \\\n", "site_id \n", "AVOCAn0001 31.2620 165.4760 166.7296 \n", "AVOCAn0002 37.0803 256.4137 258.9174 \n", "AVOCAn0003 45.5960 372.7031 373.9198 \n", "AVOCAn0004 60.7674 275.1689 276.0476 \n", "AVOCAn0005 65.8524 268.5194 263.4262 \n", "AVOCAn0006 65.1438 202.6770 198.2397 \n", "AVOCAn0007 64.0168 149.8479 143.1312 \n", "AVOCAn0008 54.4567 187.9201 187.3459 \n", "AVOCAn0009 97.1908 NaN NaN \n", "AVOCAs0001 NaN NaN NaN \n", "AVOCAs0002 72.6226 NaN NaN \n", "AVOCAs0003 43.5282 NaN NaN \n", "AVOCAs0004 53.3691 NaN NaN \n", "AVOCAs0005 42.2088 NaN NaN \n", "AVOCAs0006 39.8157 NaN NaN \n", "AVOCAs0007 32.9331 NaN NaN \n", "AVOCAs0008 14.2770 NaN NaN \n", "BILG0001 60.9913 NaN NaN \n", "BILG0002 36.8876 NaN NaN \n", "BILG0003 36.5817 41.1469 40.6081 \n", "BILG0004 26.5512 11.2211 11.0892 \n", "BILG0005 22.7539 613.6156 606.2766 \n", "BLUEYS0001 70.5270 130.7447 120.5446 \n", "BLUEYS0002 79.4836 512.0154 477.1774 \n", "BLUEYS0003 77.9418 443.0853 414.3901 \n", "BLUEYS0004 67.0737 287.5805 272.4267 \n", "BLUEYS0005 58.7036 539.3864 520.0732 \n", "BLUEYS0006 41.0032 271.6036 267.1954 \n", "BOAT0001 -0.1108 NaN NaN \n", "BOAT0002 62.7624 NaN NaN \n", "... ... ... ... \n", "TREACH0014 52.3740 508.7400 505.7877 \n", "TREACH0015 53.3254 690.8275 683.4458 \n", "TREACH0016 37.7547 508.0014 499.6315 \n", "WAMBE0001 -7.3488 665.9898 667.5923 \n", "WAMBE0002 15.8449 385.8467 386.7284 \n", "WAMBE0003 23.5068 694.2226 700.5105 \n", "WAMBE0004 44.4503 559.5485 569.8591 \n", "WAMBE0005 NaN NaN NaN \n", "WAMBE0006 10.9739 55.0898 55.8919 \n", "WAMBE0007 55.9307 178.1005 178.5439 \n", "WAMBE0008 54.4187 258.7513 258.3849 \n", "WAMBE0009 63.0913 267.3725 258.3720 \n", "WAMBE0010 69.2437 187.5259 161.9748 \n", "WAMBE0011 72.4577 197.0129 175.2512 \n", "WAMBE0012 69.0627 178.4783 168.3475 \n", "WAMBE0013 67.7224 231.1513 195.2581 \n", "WAMBE0014 64.4802 82.4268 61.2601 \n", "WAMBE0015 70.9286 NaN NaN \n", "WAMBE0016 58.8479 NaN NaN \n", "WAMBE0017 75.8801 NaN NaN \n", "WAMBE0018 74.3173 NaN NaN \n", "WAMBE0019 75.9282 NaN NaN \n", "WAMBE0020 NaN NaN NaN \n", "WAMBE0021 NaN NaN NaN \n", "WAMBE0022 48.5063 NaN NaN \n", "WAMBE0023 91.0554 NaN NaN \n", "WAMBE0024 48.6084 NaN NaN \n", "WAMBE0025 67.6253 NaN NaN \n", "WAMBE0026 59.7716 NaN NaN \n", "WAMBE0027 28.7759 NaN NaN \n", "\n", " dune_face_vol_change dune_face_pct_change storm_regime \n", "site_id \n", "AVOCAn0001 0.0000 0.0000 swash \n", "AVOCAn0002 0.0000 0.0000 swash \n", "AVOCAn0003 -0.3147 -0.0844 swash \n", "AVOCAn0004 0.4104 0.1492 swash \n", "AVOCAn0005 7.4196 2.7631 collision \n", "AVOCAn0006 4.7944 2.3655 collision \n", "AVOCAn0007 7.1323 4.7597 collision \n", "AVOCAn0008 2.8297 1.5058 collision \n", "AVOCAn0009 NaN NaN NaN \n", "AVOCAs0001 NaN NaN NaN \n", "AVOCAs0002 NaN NaN NaN \n", "AVOCAs0003 NaN NaN NaN \n", "AVOCAs0004 NaN NaN NaN \n", "AVOCAs0005 NaN NaN NaN \n", "AVOCAs0006 NaN NaN NaN \n", "AVOCAs0007 NaN NaN NaN \n", "AVOCAs0008 NaN NaN NaN \n", "BILG0001 NaN NaN NaN \n", "BILG0002 NaN NaN NaN \n", "BILG0003 0.0000 0.0000 swash \n", "BILG0004 -0.0132 -0.1179 swash \n", "BILG0005 5.7738 0.9410 collision \n", "BLUEYS0001 9.5601 7.3121 collision \n", "BLUEYS0002 33.2825 6.5003 collision \n", "BLUEYS0003 24.8870 5.6167 collision \n", "BLUEYS0004 12.9641 4.5080 collision \n", "BLUEYS0005 12.0470 2.2335 collision \n", "BLUEYS0006 3.6045 1.3271 collision \n", "BOAT0001 NaN NaN NaN \n", "BOAT0002 NaN NaN NaN \n", "... ... ... ... \n", "TREACH0014 0.4254 0.0836 swash \n", "TREACH0015 1.5086 0.2184 NaN \n", "TREACH0016 0.3386 0.0667 swash \n", "WAMBE0001 0.0410 0.0062 swash \n", "WAMBE0002 -0.0449 -0.0116 swash \n", "WAMBE0003 -4.2136 -0.6070 swash \n", "WAMBE0004 -4.4590 -0.7969 swash \n", "WAMBE0005 NaN NaN NaN \n", "WAMBE0006 0.0000 0.0000 swash \n", "WAMBE0007 0.4727 0.2654 swash \n", "WAMBE0008 -1.2073 -0.4666 swash \n", "WAMBE0009 9.8041 3.6668 collision \n", "WAMBE0010 25.3087 13.4961 collision \n", "WAMBE0011 21.9882 11.1608 collision \n", "WAMBE0012 10.0386 5.6246 collision \n", "WAMBE0013 35.8072 15.4908 collision \n", "WAMBE0014 21.1718 25.6856 collision \n", "WAMBE0015 NaN NaN NaN \n", "WAMBE0016 NaN NaN NaN \n", "WAMBE0017 NaN NaN NaN \n", "WAMBE0018 NaN NaN NaN \n", "WAMBE0019 NaN NaN NaN \n", "WAMBE0020 NaN NaN NaN \n", "WAMBE0021 NaN NaN NaN \n", "WAMBE0022 NaN NaN NaN \n", "WAMBE0023 NaN NaN NaN \n", "WAMBE0024 NaN NaN NaN \n", "WAMBE0025 NaN NaN NaN \n", "WAMBE0026 NaN NaN NaN \n", "WAMBE0027 NaN NaN NaN \n", "\n", "[1768 rows x 9 columns]" ] }, "execution_count": 30, "metadata": {}, "output_type": "execute_result" } ], "source": [] } ], "metadata": { "hide_input": false, "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.7" }, "toc": { "base_numbering": 1, "nav_menu": { "height": "47px", "width": "262px" }, "number_sections": true, "sideBar": true, "skip_h1_title": false, "title_cell": "Table of Contents", "title_sidebar": "Contents", "toc_cell": false, "toc_position": { "height": "calc(100% - 180px)", "left": "10px", "top": "150px", "width": "275.797px" }, "toc_section_display": true, "toc_window_display": true }, "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 }