rl-institut / oemof-B3

An open-source energy system model for Brandenburg/Berlin.
https://oemof-b3.readthedocs.io/
GNU Affero General Public License v3.0
9 stars 5 forks source link

Plotting dispatch does not work anymore #297

Closed MaGering closed 1 year ago

MaGering commented 1 year ago

When I want to use the dispatch plotting I get the following error message:

INFO - 
Traceback (most recent call last):
  File "scripts/plot_dispatch.py", line 329, in <module>
    df_aggregated, df_demand_aggregated, bus_name = aggregate_by_region(
  File "scripts/plot_dispatch.py", line 284, in aggregate_by_region
    df, df_demand, bus_name = prepare_dispatch_data(bus_to_be_aggregated)
  File "scripts/plot_dispatch.py", line 63, in prepare_dispatch_data
    data = pd.read_csv(bus_path, header=[0, 1, 2], parse_dates=[0], index_col=[0])
  File "/home/local/RL-INSTITUT/marie-claire.gering/anaconda3/envs/oemof-B3/lib/python3.8/site-packages/pandas/io/parsers.py", line 688, in read_csv
    return _read(filepath_or_buffer, kwds)
  File "/home/local/RL-INSTITUT/marie-claire.gering/anaconda3/envs/oemof-B3/lib/python3.8/site-packages/pandas/io/parsers.py", line 454, in _read
    parser = TextFileReader(fp_or_buf, **kwds)
  File "/home/local/RL-INSTITUT/marie-claire.gering/anaconda3/envs/oemof-B3/lib/python3.8/site-packages/pandas/io/parsers.py", line 948, in __init__
    self._make_engine(self.engine)
  File "/home/local/RL-INSTITUT/marie-claire.gering/anaconda3/envs/oemof-B3/lib/python3.8/site-packages/pandas/io/parsers.py", line 1180, in _make_engine
    self._engine = CParserWrapper(self.f, **self.options)
  File "/home/local/RL-INSTITUT/marie-claire.gering/anaconda3/envs/oemof-B3/lib/python3.8/site-packages/pandas/io/parsers.py", line 2025, in __init__
    ) = self._extract_multi_indexer_columns(
  File "/home/local/RL-INSTITUT/marie-claire.gering/anaconda3/envs/oemof-B3/lib/python3.8/site-packages/pandas/io/parsers.py", line 1618, in _extract_multi_indexer_columns
    for n in range(len(columns[0])):
IndexError: list index out of range
[Thu Dec 15 12:02:10 2022]
INFO - [Thu Dec 15 12:02:10 2022]
Error in rule plot_dispatch:
    jobid: 0
    output: results/2050-100-el_eff/plotted/dispatch
    shell:
        python scripts/plot_dispatch.py results/2050-100-el_eff/postprocessed results/2050-100-el_eff/plotted/dispatch results/2050-100-el_eff/2050-100-el_eff.log
        (one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)

I was able to trace the error to the following commit on the dev: https://github.com/rl-institut/oemof-B3/commit/a76412d52b9f386789d56a36f989e25bbb88f9c2 where the separator has been set to the one given in oemof-B3. We do not know yet what exactly causes the error. The commit affects the formatting of postprocessed results. Since this commit, the oemof-B3 separator is used instead of the oemoflex seperator.

jnnr commented 1 year ago

File "scripts/plot_dispatch.py", line 63, in prepare_dispatch_data data = pd.read_csv(bus_path, header=[0, 1, 2], parse_dates=[0], index_col=[0])

This is straightforward - need to set the separator.