Merge branch 'feature/fix-simplify-network-buses' of github.com:Climact/pypsa-eur-climact into Climact-feature/fix-simplify-network-buses

This commit is contained in:
Fabian Neumann 2024-04-03 11:36:46 +02:00
commit 83e3f3f163
2 changed files with 14 additions and 12 deletions

View File

@ -168,6 +168,8 @@ Upcoming Release
* Fix type error with `m` option in `cluster_network`.
* 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)))