Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Dec 9, 2024
1 parent 2b31073 commit 2c494c7
Showing 1 changed file with 19 additions and 13 deletions.
32 changes: 19 additions & 13 deletions notebooks/example_abed.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -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\")"
]
},
{
Expand All @@ -47,7 +47,7 @@
"metadata": {},
"outputs": [],
"source": [
"obs.hvplot(line_dash = \"dashed\") * sim.hvplot()"
"obs.hvplot(line_dash=\"dashed\") * sim.hvplot()"
]
},
{
Expand All @@ -67,6 +67,7 @@
"outputs": [],
"source": [
"from seastats import GENERAL_METRICS, STORM_METRICS\n",
"\n",
"GENERAL_METRICS\n",
"STORM_METRICS"
]
Expand All @@ -78,7 +79,7 @@
"outputs": [],
"source": [
"stats = get_stats(obs, sim)\n",
"pd.DataFrame(stats, index = ['abed'])"
"pd.DataFrame(stats, index=[\"abed\"])"
]
},
{
Expand All @@ -95,6 +96,7 @@
"outputs": [],
"source": [
"from seastats import GENERAL_METRICS_ALL, STORM_METRICS_ALL\n",
"\n",
"GENERAL_METRICS_ALL\n",
"STORM_METRICS_ALL"
]
Expand Down Expand Up @@ -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_"
]
},
Expand Down Expand Up @@ -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_"
]
},
Expand All @@ -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"
]
},
Expand All @@ -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"
]
},
Expand All @@ -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\"])"
]
},
{
Expand All @@ -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\"])"
]
}
],
Expand Down

0 comments on commit 2c494c7

Please sign in to comment.