From 55ba752e3ebf38a19ccb85f5ab464107ff20dee5 Mon Sep 17 00:00:00 2001 From: ClaraBuettner Date: Wed, 20 Sep 2023 09:16:17 +0200 Subject: [PATCH] Fix comparisions to None and True --- etrago/cluster/electrical.py | 3 ++- etrago/cluster/spatial.py | 2 +- etrago/tools/execute.py | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/etrago/cluster/electrical.py b/etrago/cluster/electrical.py index a70a3b28..44fc5526 100755 --- a/etrago/cluster/electrical.py +++ b/etrago/cluster/electrical.py @@ -178,7 +178,8 @@ def adjust_no_electric_network(etrago, busmap, cluster_met): & (network2.links["carrier"] == map_carrier[carry]) ].copy() df["elec"] = df["bus0"].isin(busmap.keys()) - df = df[df["elec"] is True] + + df = df[df["elec"]] if len(df) > 0: bus_hv = df["bus0"][0] diff --git a/etrago/cluster/spatial.py b/etrago/cluster/spatial.py index 7499ae19..be78296a 100755 --- a/etrago/cluster/spatial.py +++ b/etrago/cluster/spatial.py @@ -98,7 +98,7 @@ def nan_links(x): def ext_storage(x): - v = any(x[x is True]) + v = any(x[x]) return v diff --git a/etrago/tools/execute.py b/etrago/tools/execute.py index 81844c22..1175ef9e 100755 --- a/etrago/tools/execute.py +++ b/etrago/tools/execute.py @@ -810,7 +810,7 @@ def import_gen_from_links(network): # if foreign lines are DC, execute pf only on sub_network in Germany if (args["foreign_lines"]["carrier"] == "DC") or ( - (args["scn_extension"] is None) + (args["scn_extension"] is not None) and ("BE_NO_NEP 2035" in args["scn_extension"]) ): foreign_bus, foreign_comp, foreign_series = drop_foreign_components( @@ -883,7 +883,7 @@ def import_gen_from_links(network): if ( (args["foreign_lines"]["carrier"] == "DC") or ( - (args["scn_extension"] is None) + (args["scn_extension"] is not None) and ("BE_NO_NEP 2035" in args["scn_extension"]) ) ) and etrago.args["pf_post_lopf"]["add_foreign_lopf"]: