diff --git a/notebooks/example_abed.ipynb b/notebooks/example_abed.ipynb index bf2e2e2..797c3ee 100644 --- a/notebooks/example_abed.ipynb +++ b/notebooks/example_abed.ipynb @@ -26,8 +26,8 @@ "metadata": {}, "outputs": [], "source": [ - "sim = pd.read_parquet('../tests/data/abed_sim.parquet')\n", - "obs = pd.read_parquet('../tests/data/abed_obs.parquet')" + "sim = pd.read_parquet(\"../tests/data/abed_sim.parquet\")\n", + "obs = pd.read_parquet(\"../tests/data/abed_obs.parquet\")" ] }, { @@ -47,7 +47,7 @@ "metadata": {}, "outputs": [], "source": [ - "obs.hvplot(line_dash = \"dashed\") * sim.hvplot()" + "obs.hvplot(line_dash=\"dashed\") * sim.hvplot()" ] }, { @@ -67,6 +67,7 @@ "outputs": [], "source": [ "from seastats import GENERAL_METRICS, STORM_METRICS\n", + "\n", "GENERAL_METRICS\n", "STORM_METRICS" ] @@ -78,7 +79,7 @@ "outputs": [], "source": [ "stats = get_stats(obs, sim)\n", - "pd.DataFrame(stats, index = ['abed'])" + "pd.DataFrame(stats, index=[\"abed\"])" ] }, { @@ -95,6 +96,7 @@ "outputs": [], "source": [ "from seastats import GENERAL_METRICS_ALL, STORM_METRICS_ALL\n", + "\n", "GENERAL_METRICS_ALL\n", "STORM_METRICS_ALL" ] @@ -149,7 +151,7 @@ "source": [ "threshold = sim.quantile(quantile)\n", "ext_ = get_extremes(sim, \"POT\", threshold=threshold, r=f\"{cluster_duration}h\")\n", - "extremes1 = pd.DataFrame({\"modeled\" : ext_, \"time_model\" : ext_.index}, index=ext_.index)\n", + "extremes1 = pd.DataFrame({\"modeled\": ext_, \"time_model\": ext_.index}, index=ext_.index)\n", "ext_" ] }, @@ -178,7 +180,7 @@ "source": [ "threshold = obs.quantile(quantile)\n", "ext_ = get_extremes(obs, \"POT\", threshold=threshold, r=f\"{cluster_duration}h\")\n", - "extremes2 = pd.DataFrame({\"modeled\" : ext_, \"time_model\" : ext_.index}, index=ext_.index)\n", + "extremes2 = pd.DataFrame({\"modeled\": ext_, \"time_model\": ext_.index}, index=ext_.index)\n", "ext_" ] }, @@ -188,7 +190,9 @@ "metadata": {}, "outputs": [], "source": [ - "obs_plot = obs.hvplot(line_dash = \"dashed\") * hv.Scatter((extremes2.index, extremes2.modeled)).opts(color=\"red\")\n", + "obs_plot = obs.hvplot(line_dash=\"dashed\") * hv.Scatter((extremes2.index, extremes2.modeled)).opts(\n", + " color=\"red\"\n", + ")\n", "obs_plot" ] }, @@ -206,7 +210,8 @@ "outputs": [], "source": [ "from seastats.storms import match_extremes\n", - "extremes_df = match_extremes(sim, obs, 0.99, cluster = 72)\n", + "\n", + "extremes_df = match_extremes(sim, obs, 0.99, cluster=72)\n", "extremes_df" ] }, @@ -217,10 +222,11 @@ "outputs": [], "source": [ "hv.Points(\n", - " extremes_df[['tdiff','diff']].rename(columns={'tdiff':'time difference (hours)','diff':'peak difference (m)'}), \n", - " kdims=['time difference (hours)','peak difference (m)']).opts(\n", - " size = 8, tools = ['hover']\n", - " )" + " extremes_df[[\"tdiff\", \"diff\"]].rename(\n", + " columns={\"tdiff\": \"time difference (hours)\", \"diff\": \"peak difference (m)\"}\n", + " ),\n", + " kdims=[\"time difference (hours)\", \"peak difference (m)\"],\n", + ").opts(size=8, tools=[\"hover\"])" ] }, { @@ -244,7 +250,7 @@ "outputs": [], "source": [ "metrics = get_stats(sim, obs, quantile=0.99, cluster=72)\n", - "pd.DataFrame(dict(stats, **metrics), index=['abed'])" + "pd.DataFrame(dict(stats, **metrics), index=[\"abed\"])" ] } ],