From 4107e316283a66b1a66b5ea2da245975671df5c6 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 17 Sep 2024 13:39:40 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- scripts/add_brownfield.py | 3 ++- scripts/prepare_perfect_foresight.py | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/scripts/add_brownfield.py b/scripts/add_brownfield.py index e0f3e0248..12db7c403 100644 --- a/scripts/add_brownfield.py +++ b/scripts/add_brownfield.py @@ -205,7 +205,8 @@ def adjust_renewable_profiles(n, input_profiles, params, year): def update_heat_pump_efficiency(n: pypsa.Network, n_p: pypsa.Network, year: int): """ - Update the efficiency of heat pumps from previous years to current year (e.g. 2030 heat pumps receive 2040 heat pump COPs in 2030). + Update the efficiency of heat pumps from previous years to current year + (e.g. 2030 heat pumps receive 2040 heat pump COPs in 2030). Parameters ---------- diff --git a/scripts/prepare_perfect_foresight.py b/scripts/prepare_perfect_foresight.py index 6d4071c83..77f1062f5 100644 --- a/scripts/prepare_perfect_foresight.py +++ b/scripts/prepare_perfect_foresight.py @@ -487,9 +487,11 @@ def apply_time_segmentation_perfect( return n + def update_heat_pump_efficiency(n: pypsa.Network, years: List[int]): """ - Update the efficiency of heat pumps from previous years to current year (e.g. 2030 heat pumps receive 2040 heat pump COPs in 2030). + Update the efficiency of heat pumps from previous years to current year + (e.g. 2030 heat pumps receive 2040 heat pump COPs in 2030). Note: this also updates the efficiency of heat pumps in preceding years for previous years, which should have no effect (e.g. 2040 heat pumps receive 2030 COPs in 2030). @@ -510,8 +512,12 @@ def update_heat_pump_efficiency(n: pypsa.Network, years: List[int]): if "heat pump" in link_name: heat_pump_name = link_name[:-4] for year in years: - correct_efficiency = n.links_t["efficiency"].loc[(year, slice(None)), heat_pump_name+str(year)] - n.links_t["efficiency"].loc[(year, slice(None)), link_name] = correct_efficiency + correct_efficiency = n.links_t["efficiency"].loc[ + (year, slice(None)), heat_pump_name + str(year) + ] + n.links_t["efficiency"].loc[ + (year, slice(None)), link_name + ] = correct_efficiency if __name__ == "__main__":