-
Notifications
You must be signed in to change notification settings - Fork 389
Closed
Copy link
Description
Version Checks (indicate both or one)
-
I have confirmed this bug exists on the lastest release of PyPSA-Eur.
-
I have confirmed this bug exists on the current
masterbranch of PyPSA-Eur.
Issue Description
When one of the carrier_groups defined for plot_balance_timeseries is not included in the model scope (e.g. heating), the workflow will break at this postprocessing step since none of the carriers defined for this group are included in the network. A fix is needed here to either:
- be able to overwrite the default plotting configuration so that you can deactivate a
carrier_groupforbalance_timeserieshere - or check for missing/empty
carrier_groupsinplot_balance_timeseries.py
Reproducible Example
# Run
snakemake -call --configfile config/test/config.overnight.yaml
# with the following changes in config/test/config.overnight.yaml:
sector:
heating: false
industry: false
agriculture: false
shipping: false
aviation: false
biomass: false
plotting:
balance_map:
bus_carriers:
- AC
- H2
- gas
- oil
- co2 storedExpected Behavior
This will run into a workflow error in plot_balance_timeseries:
Traceback (most recent call last):
File "/Users/daniel/Desktop/Work/OET/Coding/my_forks/pypsa-eur/.snakemake/scripts/tmpnwatj5uv.plot_balance_timeseries.py", line 256, in <module>
list(tqdm(pool.imap(func, groups.items()), **tqdm_kwargs))
File "/opt/homebrew/Caskroom/miniforge/base/envs/pypsa-eur/lib/python3.12/site-packages/tqdm/std.py", line 1181, in __iter__
for obj in iterable:
^^^^^^^^
File "/opt/homebrew/Caskroom/miniforge/base/envs/pypsa-eur/lib/python3.12/multiprocessing/pool.py", line 873, in next
raise value
File "/opt/homebrew/Caskroom/miniforge/base/envs/pypsa-eur/lib/python3.12/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
^^^^^^^^^^^^^^^^^
File "/Users/daniel/Desktop/Work/OET/Coding/my_forks/pypsa-eur/scripts/plot_balance_timeseries.py", line 177, in process_carrier
plot_energy_balance_timeseries(
^^^^^^^^^^^^^^^^^
File "/Users/daniel/Desktop/Work/OET/Coding/my_forks/pypsa-eur/scripts/plot_balance_timeseries.py", line 112, in plot_energy_balance_timeseries
plot_stacked_area_steplike(ax, pos, colors)
^^^^^^^^^^^^^^^^^
File "/Users/daniel/Desktop/Work/OET/Coding/my_forks/pypsa-eur/scripts/plot_balance_timeseries.py", line 33, in plot_stacked_area_steplike
previous_series = np.zeros_like(df_cum.iloc[:, 0].values)
^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniforge/base/envs/pypsa-eur/lib/python3.12/site-packages/pandas/core/indexing.py", line 1184, in __getitem__
return self._getitem_tuple(key)
^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniforge/base/envs/pypsa-eur/lib/python3.12/site-packages/pandas/core/indexing.py", line 1690, in _getitem_tuple
tup = self._validate_tuple_indexer(tup)
^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniforge/base/envs/pypsa-eur/lib/python3.12/site-packages/pandas/core/indexing.py", line 966, in _validate_tuple_indexer
self._validate_key(k, i)
^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniforge/base/envs/pypsa-eur/lib/python3.12/site-packages/pandas/core/indexing.py", line 1592, in _validate_key
self._validate_integer(key, axis)
^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Caskroom/miniforge/base/envs/pypsa-eur/lib/python3.12/site-packages/pandas/core/indexing.py", line 1685, in _validate_integer
raise IndexError("single positional indexer is out-of-bounds")
^^^^^^^^^^^^^^^^^
IndexError: single positional indexer is out-of-bounds
Installed Versions
Details
Replace this line.Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels