`plot_statistics` does not work when `model_topology.topological_boundaries` is set to `state`
Nobody has claimed this yet.
- 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 set the topological_boundaries to be state I get the error message below on an solved network with an optimal solution
Error in rule plot_statistics:
jobid: 24
input: results/imports_test_state/western/networks/elec_s50_c12_ec_lv1.0_3h_E.nc, resources/imports_test_state/western/Geospatial/regions_onshore_s50_12.geojson, resources/imports_test_state/western/Geospatial/regions_offshore_s50_12.geojson
output: results/imports_test_state/western/figures/s50_cluster_12/lv1.0_3h_E/emissions/emissions_area.pdf, results/imports_test_state/western/figures/s50_cluster_12/lv1.0_3h_E/emissions/emissions_accumulated.pdf, results/imports_test_state/western/figures/s50_cluster_12/lv1.0_3h_E/emissions/emissions_accumulated_tech.pdf, results/imports_test_state/western/figures/s50_cluster_12/lv1.0_3h_E/emissions/bar_regional_emissions.pdf, results/imports_test_state/western/figures/s50_cluster_12/lv1.0_3h_E/emissions/bar_emissions.pdf, results/imports_test_state/western/figures/s50_cluster_12/lv1.0_3h_E/production/production_area.pdf, results/imports_test_state/western/figures/s50_cluster_12/lv1.0_3h_E/system/production_bar.pdf, results/imports_test_state/western/figures/s50_cluster_12/lv1.0_3h_E/system/capacity_additions_bar.pdf, results/imports_test_state/western/figures/s50_cluster_12/lv1.0_3h_E/system/bar_regional_capacity_additions.pdf, results/imports_test_state/western/figures/s50_cluster_12/lv1.0_3h_E/system/bar_regional_production.pdf, results/imports_test_state/western/figures/s50_cluster_12/lv1.0_3h_E/system/global_constraint_shadow_prices.pdf, results/imports_test_state/western/figures/s50_cluster_12/lv1.0_3h_E/system/generator_data_panel.pdf, results/imports_test_state/western/figures/s50_cluster_12/lv1.0_3h_E/system/fuel_costs.pdf, results/imports_test_state/western/figures/s50_cluster_12/lv1.0_3h_E/system/region_lmps.pdf, results/imports_test_state/western/figures/s50_cluster_12/lv1.0_3h_E/statistics/statistics.csv, results/imports_test_state/western/figures/s50_cluster_12/lv1.0_3h_E/statistics/statistics_dissaggregated.csv, results/imports_test_state/western/figures/s50_cluster_12/lv1.0_3h_E/statistics/generators.csv, results/imports_test_state/western/figures/s50_cluster_12/lv1.0_3h_E/statistics/storage_units.csv, results/imports_test_state/western/figures/s50_cluster_12/lv1.0_3h_E/statistics/links.csv, results/imports_test_state/western/figures/s50_cluster_12/lv1.0_3h_E/statistics/buses.csv, results/imports_test_state/western/figures/s50_cluster_12/lv1.0_3h_E/statistics/lines.csv, results/imports_test_state/western/figures/s50_cluster_12/lv1.0_3h_E/statistics/stores.csv
log: logs/plot_figures/western_50_12_lv1.0_3h_E.log (check log file(s) for error details)
Steps To Reproduce
# docs :
scenario:
interconnect: [western] #"usa|texas|western|eastern"
clusters: [12]
simpl: [50]
opts: [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/tmp88kr109_.plot_statistics.py", line 989, in <module>
plot_regional_capacity_additions_bar(
File "/home/trevor/master/pypsa-usa/workflow/.snakemake/scripts/tmp88kr109_.plot_statistics.py", line 404, in plot_regional_capacity_additions_bar
data = get_statistics(n, "Optimal Capacity")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/trevor/master/pypsa-usa/workflow/.snakemake/scripts/tmp88kr109_.plot_statistics.py", line 297, in get_statistics
gens_reg = gens.map(n.generators.bus.map(n.buses.nerc_reg)).to_series()
^^^^^^^^^^^^^^^^
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 'nerc_reg'
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 the plot_statistics entry point and the generated workflow/.snakemake/scripts/tmp88kr109_.plot_statistics.py traceback, especially get_statistics and plot_regional_capacity_additions_bar. Reproduce the state-boundary configuration and inspect the referenced network bus data. Done means plot_statistics completes for topological_boundaries: state and produces the listed statistics and figure outputs without the nerc_reg error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data-visualization
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100