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

TypeError in rule prepare_gas_network #327

Open
2 tasks done
doneachh opened this issue Jun 2, 2024 · 0 comments
Open
2 tasks done

TypeError in rule prepare_gas_network #327

doneachh opened this issue Jun 2, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@doneachh
Copy link
Collaborator

doneachh commented Jun 2, 2024

Checklist

  • I am using the current main branch or the latest release. Please indicate.
  • I am running on an up-to-date pypsa-africa environment. Update via conda env update -f envs/environment.yaml.

Describe the Bug

We receive a TypeError in rule prepare_gas_network, as we put two digits codes into the method three_2_two_digits_code (--> returns nan value) and try to add them with a string value afterwards.

Error Message

Traceback (most recent call last):
  File "/mnt/l/Git/Africa/pypsa-earth-sec/.snakemake/scripts/tmpvjh_6i9i.prepare_gas_network.py", line 924, in <module>
    pipelines["bus0"] = pipelines["bus0"].apply(
  File "/home/aca39878/anaconda3/envs/pypsa-earth/lib/python3.10/site-packages/pandas/core/series.py", line 4924, in apply
    ).apply()
  File "/home/aca39878/anaconda3/envs/pypsa-earth/lib/python3.10/site-packages/pandas/core/apply.py", line 1427, in apply
    return self.apply_standard()
  File "/home/aca39878/anaconda3/envs/pypsa-earth/lib/python3.10/site-packages/pandas/core/apply.py", line 1507, in apply_standard
    mapped = obj._map_values(
  File "/home/aca39878/anaconda3/envs/pypsa-earth/lib/python3.10/site-packages/pandas/core/base.py", line 921, in _map_values
    return algorithms.map_array(arr, mapper, na_action=na_action, convert=convert)
  File "/home/aca39878/anaconda3/envs/pypsa-earth/lib/python3.10/site-packages/pandas/core/algorithms.py", line 1743, in map_array
    return lib.map_infer(values, mapper, convert=convert)
  File "lib.pyx", line 2972, in pandas._libs.lib.map_infer
  File "/mnt/l/Git/Africa/pypsa-earth-sec/.snakemake/scripts/tmpvjh_6i9i.prepare_gas_network.py", line 925, in <lambda>
    lambda id: three_2_two_digits_country(id[:3]) + id[3:]
TypeError: unsupported operand type(s) for +: 'float' and 'str'
[Sat Jun  1 22:51:19 2024]
Error in rule prepare_gas_network:
    jobid: 25
    input: /mnt/l/Git/Africa/pypsa-earth-sec/pypsa-earth/resources/bus_regions/regions_onshore_elec_s_165.geojson
    output: resources/gas_networks/gas_network_elec_s_165.csv, resources/gas_networks/existing_gas_pipelines__165.png, resources/gas_networks/clustered_gas_pipelines__165.png

RuleException:
CalledProcessError in file /mnt/l/Git/Africa/pypsa-earth-sec/Snakefile, line 158:
Command 'set -euo pipefail;  /home/aca39878/anaconda3/envs/pypsa-earth/bin/python3.10 /mnt/l/Git/Africa/pypsa-earth-sec/.snakemake/scripts/tmpvjh_6i9i.prepare_gas_network.py' returned non-zero exit status 1.
  File "/mnt/l/Git/Africa/pypsa-earth-sec/Snakefile", line 158, in __rule_prepare_gas_network
  File "/home/aca39878/anaconda3/envs/pypsa-earth/lib/python3.10/concurrent/futures/thread.py", line 58, in run
Removing output files of failed job prepare_gas_network since they might be corrupted:
resources/gas_networks/existing_gas_pipelines__165.png
Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
@doneachh doneachh added the bug Something isn't working label Jun 2, 2024
@doneachh doneachh self-assigned this Jun 2, 2024
@doneachh doneachh linked a pull request Jun 2, 2024 that will close this issue
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant