Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for "clusters" wildcard and hint for max (and min) value. #1149

Open
fhg-isi opened this issue Jul 12, 2024 · 0 comments
Open

Check for "clusters" wildcard and hint for max (and min) value. #1149

fhg-isi opened this issue Jul 12, 2024 · 0 comments

Comments

@fhg-isi
Copy link
Contributor

fhg-isi commented Jul 12, 2024

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:

#1150

@fhg-isi fhg-isi changed the title Check for "clusters" wildcard and hint for max value. Check for "clusters" wildcard and hint for max (and min) value. Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant