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 Oct 7, 2024
1 parent 49f9956 commit 1fe4e25
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 34 deletions.
32 changes: 20 additions & 12 deletions notebooks/co2scenarios.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -264,9 +264,11 @@
"\n",
" df = df.loc[carrier].groupby(level=2).sum().div(1e6) # TWh / MtCO2\n",
" df.index = [\n",
" i[:-1]\n",
" if ((i not in [\"co2\", \"NH3\", \"H2\"]) and (i[-1:] in [\"0\", \"1\", \"2\", \"3\"]))\n",
" else i\n",
" (\n",
" i[:-1]\n",
" if ((i not in [\"co2\", \"NH3\", \"H2\"]) and (i[-1:] in [\"0\", \"1\", \"2\", \"3\"]))\n",
" else i\n",
" )\n",
" for i in df.index\n",
" ]\n",
"\n",
Expand Down Expand Up @@ -396,9 +398,11 @@
"\n",
" toprow_kwargs = (\n",
" dict(\n",
" title=\"with\\nhydrogen grid\\n\"\n",
" if y[1] == \"H2 grid\"\n",
" else \"without\\nhydrogen grid\\n\"\n",
" title=(\n",
" \"with\\nhydrogen grid\\n\"\n",
" if y[1] == \"H2 grid\"\n",
" else \"without\\nhydrogen grid\\n\"\n",
" )\n",
" )\n",
" if x[0] == 0\n",
" else {}\n",
Expand Down Expand Up @@ -704,9 +708,11 @@
"outputs": [],
"source": [
"df.index = [\n",
" i[:-1]\n",
" if ((i not in [\"co2\", \"NH3\", \"H2\"]) and (i[-1:] in [\"0\", \"1\", \"2\", \"3\"]))\n",
" else i\n",
" (\n",
" i[:-1]\n",
" if ((i not in [\"co2\", \"NH3\", \"H2\"]) and (i[-1:] in [\"0\", \"1\", \"2\", \"3\"]))\n",
" else i\n",
" )\n",
" for i in df.index\n",
"]"
]
Expand Down Expand Up @@ -917,9 +923,11 @@
"outputs": [],
"source": [
"df.index = [\n",
" i[:-1]\n",
" if ((i not in [\"co2\", \"NH3\", \"H2\"]) and (i[-1:] in [\"0\", \"1\", \"2\", \"3\"]))\n",
" else i\n",
" (\n",
" i[:-1]\n",
" if ((i not in [\"co2\", \"NH3\", \"H2\"]) and (i[-1:] in [\"0\", \"1\", \"2\", \"3\"]))\n",
" else i\n",
" )\n",
" for i in df.index\n",
"]"
]
Expand Down
8 changes: 5 additions & 3 deletions notebooks/preprocess-dashboard.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,11 @@
"source": [
"kwargs = dict(index_col=0, header=0)\n",
"ts = {\n",
" k: pd.read_csv(v + \"edges-hydrogen.csv\", **kwargs)\n",
" if os.path.exists(v + \"edges-hydrogen.csv\")\n",
" else None\n",
" k: (\n",
" pd.read_csv(v + \"edges-hydrogen.csv\", **kwargs)\n",
" if os.path.exists(v + \"edges-hydrogen.csv\")\n",
" else None\n",
" )\n",
" for k, v in SCENARIOS.items()\n",
"}\n",
"\n",
Expand Down
6 changes: 3 additions & 3 deletions notebooks/sankey.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,9 @@
" df.loc[df.label.str.contains(\"heat pump\"), \"value\"] -= hp_elec[\"value\"].values\n",
"\n",
" df.loc[df.label.str.contains(\"air heat pump\"), \"source\"] = \"air-sourced ambient\"\n",
" df.loc[\n",
" df.label.str.contains(\"ground heat pump\"), \"source\"\n",
" ] = \"ground-sourced ambient\"\n",
" df.loc[df.label.str.contains(\"ground heat pump\"), \"source\"] = (\n",
" \"ground-sourced ambient\"\n",
" )\n",
"\n",
" df = pd.concat([df, hp_elec])\n",
" df = df.set_index([\"label\", \"source\", \"target\"]).squeeze()\n",
Expand Down
32 changes: 20 additions & 12 deletions notebooks/scenarios.py.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -705,9 +705,11 @@
"\n",
" df = df.loc[carrier].groupby(level=2).sum().div(1e6) # TWh / MtCO2\n",
" df.index = [\n",
" i[:-1]\n",
" if ((i not in [\"co2\", \"NH3\", \"H2\"]) and (i[-1:] in [\"0\", \"1\", \"2\", \"3\"]))\n",
" else i\n",
" (\n",
" i[:-1]\n",
" if ((i not in [\"co2\", \"NH3\", \"H2\"]) and (i[-1:] in [\"0\", \"1\", \"2\", \"3\"]))\n",
" else i\n",
" )\n",
" for i in df.index\n",
" ]\n",
"\n",
Expand Down Expand Up @@ -771,9 +773,11 @@
" df = df.groupby(level=2).sum().div(1e6)\n",
"\n",
" df.index = [\n",
" i[:-1]\n",
" if ((i not in [\"co2\", \"NH3\", \"H2\"]) and (i[-1:] in [\"0\", \"1\", \"2\", \"3\"]))\n",
" else i\n",
" (\n",
" i[:-1]\n",
" if ((i not in [\"co2\", \"NH3\", \"H2\"]) and (i[-1:] in [\"0\", \"1\", \"2\", \"3\"]))\n",
" else i\n",
" )\n",
" for i in df.index\n",
" ]\n",
"\n",
Expand Down Expand Up @@ -845,9 +849,11 @@
" df = df.groupby(level=2).sum().div(1e6)\n",
"\n",
" df.index = [\n",
" i[:-1]\n",
" if ((i not in [\"co2\", \"NH3\", \"H2\"]) and (i[-1:] in [\"0\", \"1\", \"2\", \"3\"]))\n",
" else i\n",
" (\n",
" i[:-1]\n",
" if ((i not in [\"co2\", \"NH3\", \"H2\"]) and (i[-1:] in [\"0\", \"1\", \"2\", \"3\"]))\n",
" else i\n",
" )\n",
" for i in df.index\n",
" ]\n",
"\n",
Expand Down Expand Up @@ -3458,9 +3464,11 @@
"\n",
" toprow_kwargs = (\n",
" dict(\n",
" title=\"with\\nhydrogen grid\\n\"\n",
" if y[1] == \"H2 grd\"\n",
" else \"without\\nhydrogen grid\\n\"\n",
" title=(\n",
" \"with\\nhydrogen grid\\n\"\n",
" if y[1] == \"H2 grd\"\n",
" else \"without\\nhydrogen grid\\n\"\n",
" )\n",
" )\n",
" if x[0] == 0\n",
" else {}\n",
Expand Down
10 changes: 6 additions & 4 deletions notebooks/single.py.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3301,10 +3301,12 @@
"\n",
" # Create tick labels from timestamps\n",
" labels = [\n",
" ts.strftime(f\"{minor_fmt}\\n{major_fmt}\")\n",
" if (getattr(ts, major_attr) != getattr(timestamps[idx - 1], major_attr))\n",
" | (idx == 0) # | (idx == len(timestamps)-1)\n",
" else ts.strftime(minor_fmt)\n",
" (\n",
" ts.strftime(f\"{minor_fmt}\\n{major_fmt}\")\n",
" if (getattr(ts, major_attr) != getattr(timestamps[idx - 1], major_attr))\n",
" | (idx == 0) # | (idx == len(timestamps)-1)\n",
" else ts.strftime(minor_fmt)\n",
" )\n",
" for idx, ts in enumerate(timestamps)\n",
" ]\n",
"\n",
Expand Down

0 comments on commit 1fe4e25

Please sign in to comment.