From c311f7bdf83b3b8d80c5ba103753da66daf967b0 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 13 May 2024 15:33:32 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- scripts/make_summary.py | 49 ++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 20 deletions(-) diff --git a/scripts/make_summary.py b/scripts/make_summary.py index dc1aaac1..5746697b 100644 --- a/scripts/make_summary.py +++ b/scripts/make_summary.py @@ -415,8 +415,8 @@ def calculate_supply_energy(n, label, supply_energy): def calculate_nodal_supply_energy(n, label, nodal_supply_energy): """ - Calculate the total energy supply/consumption of each component at the buses - aggregated by carrier and node. + Calculate the total energy supply/consumption of each component at the + buses aggregated by carrier and node. """ bus_carriers = n.buses.carrier.unique() @@ -432,22 +432,27 @@ def calculate_nodal_supply_energy(n, label, nodal_supply_energy): continue s = ( - pd.concat([ - ( - c.pnl.p[items] - .multiply(n.snapshot_weightings.generators, axis=0) - .sum() - .multiply(c.df.loc[items, "sign"]) - ), - c.df.loc[items][["bus", "carrier"]] - ], axis=1) + pd.concat( + [ + ( + c.pnl.p[items] + .multiply(n.snapshot_weightings.generators, axis=0) + .sum() + .multiply(c.df.loc[items, "sign"]) + ), + c.df.loc[items][["bus", "carrier"]], + ], + axis=1, + ) .groupby(by=["bus", "carrier"]) .sum()[0] ) s = pd.concat([s], keys=[c.list_name]) s = pd.concat([s], keys=[i]) - nodal_supply_energy = nodal_supply_energy.reindex(s.index.union(nodal_supply_energy.index)) + nodal_supply_energy = nodal_supply_energy.reindex( + s.index.union(nodal_supply_energy.index) + ) nodal_supply_energy.loc[s.index, label] = s for c in n.iterate_components(n.branch_components): @@ -458,14 +463,18 @@ def calculate_nodal_supply_energy(n, label, nodal_supply_energy): continue s = ( - pd.concat([ - ( - (-1) * c.pnl["p" + end][items] - .multiply(n.snapshot_weightings.generators, axis=0) - .sum() - ), - c.df.loc[items][["bus0", "carrier"]] - ], axis=1) + pd.concat( + [ + ( + (-1) + * c.pnl["p" + end][items] + .multiply(n.snapshot_weightings.generators, axis=0) + .sum() + ), + c.df.loc[items][["bus0", "carrier"]], + ], + axis=1, + ) .groupby(by=["bus0", "carrier"]) .sum()[0] )