Check for "clusters" wildcard and hint for max (and min) value.
fhg-isi opened this issue · 0 comments
In the documentation it says "The number of clusters must be lower than the total number of nodes".
If I don't know about the total numbers of nodes and try to run the sector demo with a larger number of nodes, e.g. 37 or 25 for a single country "BE", I get errors like
KeyError: "['BE0 6 H2'] not in index"
RuleException:
CalledProcessError in file /home/projekt-resilient03/pypsa-eur/rules/postprocess.smk, line 216:
Command 'set -euo pipefail; /home/projekt-resilient03/conda/envs/pypsa-eur/bin/python3.11 /home/projekt-resilient03/pypsa-eur/.snakemake/scripts/tmp_1u5o0h8.make_summary.py' returned non-zero exit status 1.
[Fri Jul 12 09:07:51 2024]
Error in rule make_summary:
a) It might make sense to create a check for the max value of "clusters" in an earlier stage of the workflow and print an error for beginning users like.
number_of_clusters = int(snakemake.wildcards.clusters)
number_of_buses = len(n.buses)
if number_of_clusters > number_of_buses:
message = f'The value for "clusters" must be <= number of buses ({number_of_buses})'
raise ValueError(message)
For the case where clusters
< number of countries, I already get a message:
AssertionError: Number of clusters must be 37 <= n_clusters <= 3541 for this selection of countries.
(That check could be done earlier in the workflow to fail fast.)
b) It might also make sense to include some hint in the documentation on how to determine the total number of nodes. Are they already written somewhere to the console output?
c) Please document available special values for clusters
like "all".
d) If the number of buses is not the only restriction to the max value of "clusters", please clarify what those restrictions are. In the above case, the number of buses is 39 but the workflow already fails for clusters=25
:
raise KeyError(f"{not_found} not in index")
KeyError: "['BE0 6 H2'] not in index"
RuleException:
CalledProcessError in file /home/projekt-resilient03/pypsa-eur/rules/postprocess.smk, line 216:
Command 'set -euo pipefail; /home/projekt-resilient03/conda/envs/pypsa-eur/bin/python3.11 /home/projekt-resilient03/pypsa-eur/.snakemake/scripts/tmp1cdbhmgz.make_summary.py' returned non-zero exit status 1.
[Fri Jul 12 10:31:25 2024]
Error in rule make_summary:
Related: