Investment Period being dropped in Simplify Network
Open
Nobody has claimed this yet.
bug
- Dominant language
- Python
- Stars
- 148
- Forks
- 55
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 18
Description
Checklist
- I am running on an up-to-date
pypsa-usaenvironment. Update viaconda env update -f envs/environment.yaml
Issue exisits on what branch
Develop
The Issue
If I run a muti-horizon model, but for only a subset of the year (ie. Jan and Feb) the workflow fails (I do acknowledge this is kinda an odd thing to run, haha)
Steps To Reproduce
Put this in the config file
# docs :
scenario:
interconnect: ["western"] #"usa|texas|western|eastern"
clusters: [80]
opts: [Ep-Co2L0.2]
ll: [v1.0]
scope: "total" # "urban", "rural", or "total"
sector: "" # G
planning_horizons:
- 2030
- 2050 #(2030, 2040, 2050)
foresight: # Only Single Stage Currently
# docs :
enable:
build_cutout: false
snapshots:
start: "2019-01-01"
end: "2019-03-01"
inclusive: "left"
Expected Behavior
No response
Error Message
INFO:pypsa.io:Imported network elec_s.nc has buses, carriers, generators, lines, links, loads, storage_units
Traceback (most recent call last):
File "/home/trevor/repos/pypsa-usa/workflow/.snakemake/scripts/tmp7xtms1lm.cluster_network.py", line 512, in <module>
n.snapshot_weightings.loc[n.investment_periods[0]].objective.sum() / 8760.0
~~~~~~~~~~~~~~~~~~~~^^^
File "/home/trevor/miniforge3/envs/pypsa-usa/lib/python3.11/site-packages/pandas/core/indexes/base.py", line 5389, in __getitem__
return getitem(key)
^^^^^^^^^^^^
IndexError: index 0 is out of bounds for axis 0 with size
Anything else?
No response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the provided multi-horizon configuration with January and February snapshots, then inspect the generated cluster_network.py around line 512 and the handling of n.investment_periods. Done means the workflow completes for this subset-year configuration without the IndexError and retains the expected investment period.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100