Fix error with symbol of buses in simplify_network

This commit is contained in:
Thomas Gilon 2024-03-22 10:05:40 +01:00
parent 91c9dd2b82
commit 7e99f3bba7
2 changed files with 14 additions and 12 deletions

View File

@ -164,6 +164,8 @@ Upcoming Release
* Fix duplicated years in `add_land_use_constraint_m`.
* Fix error with `symbol` of `buses` in `simplify_network`.
PyPSA-Eur 0.10.0 (19th February 2024)
=====================================

View File

@ -594,18 +594,6 @@ if __name__ == "__main__":
)
busmaps.append(busmap_hac)
if snakemake.wildcards.simpl:
n, cluster_map = cluster(
n,
int(snakemake.wildcards.simpl),
params.focus_weights,
solver_name,
params.simplify_network["algorithm"],
params.simplify_network["feature"],
params.aggregation_strategies,
)
busmaps.append(cluster_map)
# some entries in n.buses are not updated in previous functions, therefore can be wrong. as they are not needed
# and are lost when clustering (for example with the simpl wildcard), we remove them for consistency:
remove = [
@ -621,6 +609,18 @@ if __name__ == "__main__":
n.buses.drop(remove, axis=1, inplace=True, errors="ignore")
n.lines.drop(remove, axis=1, errors="ignore", inplace=True)
if snakemake.wildcards.simpl:
n, cluster_map = cluster(
n,
int(snakemake.wildcards.simpl),
params.focus_weights,
solver_name,
params.simplify_network["algorithm"],
params.simplify_network["feature"],
params.aggregation_strategies,
)
busmaps.append(cluster_map)
update_p_nom_max(n)
n.meta = dict(snakemake.config, **dict(wildcards=dict(snakemake.wildcards)))