Closed Tomkourou closed 9 months ago
Original error seems to stem from this line https://github.com/PyPSA/pypsa-eur/blob/065a49c2d7e7051bb7d81e8805460f064a011ce3/scripts/add_electricity.py#L730
when Fueltype is iterating through offshore wind returns the error seen above.
Switching OPSD off for the renewable scaling allows the workflow to continue until the clustering. I'm guessing where offshore wind is not available it breaks when trying to apply weights.
Error in rule cluster_network:
jobid: 4
input: resources/networks/elec_s.nc, resources/regions_onshore_elec_s.geojson, resources/regions_offshore_elec_s.geojson, resources/busmap_elec_s.csv, data/costs_2030.csv
output: resources/networks/elec_s_37.nc, resources/regions_onshore_elec_s_37.geojson, resources/regions_offshore_elec_s_37.geojson, resources/busmap_elec_s_37.csv, resources/linemap_elec_s_37.csv
log: logs/cluster_network/elec_s_37.log (check log file(s) for error details)
conda-env: /home/adminuser/esmod/pypsa-eur-trace/.snakemake/conda/b3bd75fe7e853342b408a1e284d9a504_
RuleException:
CalledProcessError in file /home/adminuser/esmod/pypsa-eur-trace/rules/build_electricity.smk, line 445:
Command 'set -euo pipefail; /home/adminuser/mambaforge/envs/pypsa-eur/bin/python3.10 /home/adminuser/esmod/pypsa-eur-trace/.snakemake/scripts/tmp2g9948lz.cluster_network.py' returned non-zero exit status 1.
File "/home/adminuser/esmod/pypsa-eur-trace/rules/build_electricity.smk", line 445, in __rule_cluster_network
File "/home/adminuser/mambaforge/envs/pypsa-eur/lib/python3.10/concurrent/futures/thread.py", line 58, in run
Traceback (most recent call last):
File "/home/adminuser/esmod/pypsa-eur-trace/.snakemake/scripts/tmpb2516yjd.cluster_network.py", line 532, in <module>
clustering = clustering_for_n_clusters(
File "/home/adminuser/esmod/pypsa-eur-trace/.snakemake/scripts/tmpb2516yjd.cluster_network.py", line 403, in clustering_for_n_clusters
busmap = busmap_for_n_clusters(
File "/home/adminuser/esmod/pypsa-eur-trace/.snakemake/scripts/tmpb2516yjd.cluster_network.py", line 383, in busmap_for_n_clusters
.apply(busmap_for_country)
File "/home/adminuser/mambaforge/envs/pypsa-eur/lib/python3.10/site-packages/pandas/core/groupby/groupby.py", line 1770, in apply
result = self._python_apply_general(f, self._selected_obj)
File "/home/adminuser/mambaforge/envs/pypsa-eur/lib/python3.10/site-packages/pandas/core/groupby/groupby.py", line 1819, in _python_apply_general
values, mutated = self.grouper.apply_groupwise(f, data, self.axis)
File "/home/adminuser/mambaforge/envs/pypsa-eur/lib/python3.10/site-packages/pandas/core/groupby/ops.py", line 905, in apply_groupwise
res = f(group)
File "/home/adminuser/esmod/pypsa-eur-trace/.snakemake/scripts/tmpb2516yjd.cluster_network.py", line 362, in busmap_for_country
weight = weighting_for_country(n, x)
File "/home/adminuser/esmod/pypsa-eur-trace/.snakemake/scripts/tmpb2516yjd.cluster_network.py", line 179, in weighting_for_country
return (w * (100.0 / w.max())).clip(lower=1.0).astype(int)
ZeroDivisionError: float division by zero
[Mon Nov 13 15:00:25 2023]
Error in rule cluster_network:
jobid: 29
input: resources/networks/elec_s.nc, resources/regions_onshore_elec_s.geojson, resources/regions_offshore_elec_s.geojson, resources/busmap_elec_s.csv, data/costs_2030.csv
output: resources/networks/elec_s_128.nc, resources/regions_onshore_elec_s_128.geojson, resources/regions_offshore_elec_s_128.geojson, resources/busmap_elec_s_128.csv, resources/linemap_elec_s_128.csv
log: logs/cluster_network/elec_s_128.log (check log file(s) for error details)
conda-env: /home/adminuser/esmod/pypsa-eur-trace/.snakemake/conda/b3bd75fe7e853342b408a1e284d9a504_
RuleException:
CalledProcessError in file /home/adminuser/esmod/pypsa-eur-trace/rules/build_electricity.smk, line 445:
Command 'set -euo pipefail; /home/adminuser/mambaforge/envs/pypsa-eur/bin/python3.10 /home/adminuser/esmod/pypsa-eur-trace/.snakemake/scripts/tmpb2516yjd.cluster_network.py' returned non-zero exit status 1.
File "/home/adminuser/esmod/pypsa-eur-trace/rules/build_electricity.smk", line 445, in __rule_cluster_network
File "/home/adminuser/mambaforge/envs/pypsa-eur/lib/python3.10/concurrent/futures/thread.py", line 58, in run
Traceback (most recent call last):
File "/home/adminuser/esmod/pypsa-eur-trace/.snakemake/scripts/tmp5ucm9f0w.cluster_network.py", line 532, in <module>
clustering = clustering_for_n_clusters(
File "/home/adminuser/esmod/pypsa-eur-trace/.snakemake/scripts/tmp5ucm9f0w.cluster_network.py", line 403, in clustering_for_n_clusters
busmap = busmap_for_n_clusters(
File "/home/adminuser/esmod/pypsa-eur-trace/.snakemake/scripts/tmp5ucm9f0w.cluster_network.py", line 383, in busmap_for_n_clusters
.apply(busmap_for_country)
File "/home/adminuser/mambaforge/envs/pypsa-eur/lib/python3.10/site-packages/pandas/core/groupby/groupby.py", line 1770, in apply
result = self._python_apply_general(f, self._selected_obj)
File "/home/adminuser/mambaforge/envs/pypsa-eur/lib/python3.10/site-packages/pandas/core/groupby/groupby.py", line 1819, in _python_apply_general
values, mutated = self.grouper.apply_groupwise(f, data, self.axis)
File "/home/adminuser/mambaforge/envs/pypsa-eur/lib/python3.10/site-packages/pandas/core/groupby/ops.py", line 905, in apply_groupwise
res = f(group)
File "/home/adminuser/esmod/pypsa-eur-trace/.snakemake/scripts/tmp5ucm9f0w.cluster_network.py", line 362, in busmap_for_country
weight = weighting_for_country(n, x)
File "/home/adminuser/esmod/pypsa-eur-trace/.snakemake/scripts/tmp5ucm9f0w.cluster_network.py", line 179, in weighting_for_country
return (w * (100.0 / w.max())).clip(lower=1.0).astype(int)
ZeroDivisionError: float division by zero
Checklist
master
branch or the latest release. Please indicate.pypsa-eur
environment. Update viaconda env update -f envs/environment.yaml
.Describe the Bug
Getting a ValueError when running add_electricity. The error seems to stem from
attach_OPSD_renewables
in particular.Steps to reproduce this bug:
Error Message
If applicable, paste any terminal output to help illustrating your problem. In some cases it may also be useful to share your list of installed packages:
conda list
.