[x ] I am using the current master branch or the latest release. Please indicate.
[x ] I am running on an up-to-date pypsa-eur environment. Update via conda env update -f envs/environment.yaml.
Describe the Bug
Please provide a description of what the bug is and add a minimal example/command for reproducing the bug.
The issue resides in add_extra_components.py. The functions attach_stores and attach_hydrogen_pipelines create a location attribute in network.buses and consequently, sanitize_locations works perfectly.
However, if no stores or hydrogen pipelines are added in the config file, location attribute is never included in network.buses and sanitize_location yields AttributeError.
To reproduce, provide a config file without stores or hydrogen pipelines and run solve_elec_networks.
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.
[Mon Feb 19 12:23:56 2024]
rule add_extra_components:
input: resources/2024-test/networks/elec_s_2.nc, data/costs_2030_mod.csv
output: resources/2024-test/networks/elec_s_2_ec.nc
log: logs/2024-test/add_extra_components/elec_s_2.log
jobid: 3
benchmark: benchmarks/2024-test/add_extra_components/elec_s_2_ec
reason: Missing output files: resources/2024-test/networks/elec_s_2_ec.nc; Input files updated by another job: resources/2024-test/networks/elec_s_2.nc
wildcards: simpl=, clusters=2
resources: tmpdir=C:\Users\SE91723\AppData\Local\Temp, mem_mb=4000, mem_mib=3815
INFO:pypsa.io:Imported network elec_s_2.nc has buses, carriers, generators, links, loads, storage_units
WARNING:add_electricity:tech_colors for carriers ['AC', 'DC', ''] not defined in config.
ERROR:root:Uncaught exception
Traceback (most recent call last):
File "C:\Users\SE91723\Modelos\pypsa\pypsa-eur\.snakemake\scripts\tmpiy4dkx1f.add_extra_components.py", line 269, in <module>
sanitize_locations(n)
File "C:\Users\SE91723\Modelos\pypsa\pypsa-eur\rules\..\scripts\add_electricity.py", line 185, in sanitize_locations
print(n.buses.location)
File "C:\Users\SE91723\Anaconda3\envs\pypsa-eur\lib\site-packages\pandas\core\generic.py", line 6293, in __getattr__
return object.__getattribute__(self, name)
AttributeError: 'DataFrame' object has no attribute 'location'
[Mon Feb 19 12:24:06 2024]
Error in rule add_extra_components:
jobid: 3
input: resources/2024-test/networks/elec_s_2.nc, data/costs_2030_mod.csv
output: resources/2024-test/networks/elec_s_2_ec.nc
log: logs/2024-test/add_extra_components/elec_s_2.log (check log file(s) for error details)
conda-env: C:\Users\SE91723\Modelos\pypsa\pypsa-eur\.snakemake\conda\3701581752c6e5590dda85748a41c931_
Checklist
master
branch or the latest release. Please indicate.pypsa-eur
environment. Update viaconda env update -f envs/environment.yaml
.Describe the Bug
Please provide a description of what the bug is and add a minimal example/command for reproducing the bug.
The issue resides in add_extra_components.py. The functions attach_stores and attach_hydrogen_pipelines create a location attribute in network.buses and consequently, sanitize_locations works perfectly.
However, if no stores or hydrogen pipelines are added in the config file, location attribute is never included in network.buses and sanitize_location yields AttributeError.
To reproduce, provide a config file without stores or hydrogen pipelines and run solve_elec_networks.
For further context, see the pypsa community discussion: https://groups.google.com/g/pypsa/c/iNGgnejQyz4
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
.