`REM` does not work when `model_topology.topological_boundaries` is set to `state`
Open
Nobody has claimed this yet.
bug
- Dominant language
- Python
- Stars
- 148
- Forks
- 55
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 18
Description
Version Checks (indicate both or one)
-
This bug exists on the master branch of PyPSA-USA.
-
This bug exists on the develop branch of PyPSA-USA.
The Issue
If I use the REM opt and set the topological_boundaries to be state I get the error message below
Error in rule solve_network:
jobid: 2
input: resources/imports_test_state/western/elec_s50_c12_ec_lv1.0_REM-3h_E.nc, repo_data/ReEDS_Constraints/transmission/transmission_capacity_init_AC_ba_NARIS2024.csv, config/policy_constraints/reeds/prm_annual.csv, config/policy_constraints/reeds/rps_fraction.csv, config/policy_constraints/reeds/ces_fraction.csv
output: results/imports_test_state/western/networks/elec_s50_c12_ec_lv1.0_REM-3h_E.nc, results/imports_test_state/western/configs/config.elec_s50_c12_lv1.0_REM-3h_E.yaml
log: logs/imports_test_state/solve_network/western/elec_s50_c12_ec_lv1.0_REM-3h_E_solver.log, logs/imports_test_state/solve_network/western/elec_s50_c12_ec_lv1.0_REM-3h_E_python.log (check log file(s) for error details)
conda-env: /home/trevor/master/pypsa-usa/workflow/.snakemake/conda/f2078906f69fffefbbcfd811468b7163_
Steps To Reproduce
scenario:
interconnect: [western] #"usa|texas|western|eastern"
clusters: [12]
simpl: [50]
opts: [REM-3h]
ll: [v1.0]
sector: "" # G
planning_horizons: [2030] #(2018-2023, 2030, 2040, 2050)
foresight: 'perfect' # myopic, perfect
model_topology:
transmission_network: 'reeds' # [reeds, tamu]
topological_boundaries: 'state' # [county, reeds_zone, state]
interface_transmission_limits: false
include: # mixed zone types not supported
# reeds_zone: []
# reeds_state: ["CA", "OR"]
# reeds_ba: []
aggregate: # eligible keys: [reeds_zone, trans_reg]
# trans_grp: []
# reeds_zone: []
# trim:
# zone: ['CA']
Error Message
Traceback (most recent call last):
File "/home/trevor/master/pypsa-usa/workflow/.snakemake/scripts/tmpdsi_vcjg.solve_network.py", line 408, in <module>
n = solve_network(
^^^^^^^^^^^^^^
File "/home/trevor/master/pypsa-usa/workflow/.snakemake/scripts/tmpdsi_vcjg.solve_network.py", line 353, in solve_network
run_optimize(n, rolling_horizon, skip_iterations, cf_solving, **kwargs)
File "/home/trevor/master/pypsa-usa/workflow/.snakemake/scripts/tmpdsi_vcjg.solve_network.py", line 236, in run_optimize
status, condition = n.optimize(**kwargs)
^^^^^^^^^^^^^^^^^^^^
File "/home/trevor/miniforge3/envs/pypsa-usa/lib/python3.11/site-packages/pypsa/optimization/optimize.py", line 615, in __call__
return optimize(self._parent, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/trevor/miniforge3/envs/pypsa-usa/lib/python3.11/site-packages/pypsa/optimization/optimize.py", line 587, in optimize
extra_functionality(n, sns)
File "/home/trevor/master/pypsa-usa/workflow/.snakemake/scripts/tmpdsi_vcjg.solve_network.py", line 170, in extra_functionality
constraint_registry[opt]()
File "/home/trevor/master/pypsa-usa/workflow/.snakemake/scripts/tmpdsi_vcjg.solve_network.py", line 155, in <lambda>
"REM": lambda: add_regional_co2limit(n, config) if n.generators.p_nom_extendable.any() else None,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/trevor/master/pypsa-usa/workflow/rules/../scripts/opts/policy.py", line 379, in add_regional_co2limit
region_buses = get_region_buses(n, region_list)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/trevor/master/pypsa-usa/workflow/rules/../scripts/opts/_helpers.py", line 15, in get_region_buses
| n.buses.reeds_zone.isin(region_list)
^^^^^^^^^^^^^^^^^^
File "/home/trevor/miniforge3/envs/pypsa-usa/lib/python3.11/site-packages/pandas/core/generic.py", line 6299, in __getattr__
return object.__getattribute__(self, name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'DataFrame' object has no attribute 'reeds_zone'. Did you mean: 'reeds_state'?
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
Start with workflow/scripts/opts/_helpers.py:get_region_buses and workflow/scripts/opts/policy.py:add_regional_co2limit, then run the provided Snakemake scenario with REM and state topological boundaries. Trace the region selection against the traceback and verify that the scenario completes without the reported AttributeError.
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
- Clearly specified
- Newbie friendliness
- 55/100