PyPSA / pypsa-eur

PyPSA-Eur: A Sector-Coupled Open Optimisation Model of the European Energy System
https://pypsa-eur.readthedocs.io/
345 stars 242 forks source link

update reading eurostat data to recent years #533

Closed martavp closed 6 months ago

martavp commented 3 years ago

The function build_eurostat() in script build_energy_totals() needs to be updated for recent years

Until 2017, one excel file per year is provided (with one sheet per country) From 2018, one excel file per country is (with one year per country)

fneum commented 2 years ago

This is tackled in branch multiyear to eurostat June 2021

LRydin commented 7 months ago

Has this issue been solved after the merge of pypsa-eur-sec into pypsa-eur? I am running a system analysis with data from 2020 and I've bumped into

Traceback (most recent call last):
  File "/home/leo/pypsa/pypsa-eur/.snakemake/scripts/tmp88m6vsad.build_energy_totals.py", line 763, in <module>
    eurostat = build_eurostat(input_eurostat, countries, report_year, data_year)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/leo/pypsa/pypsa-eur/.snakemake/scripts/tmp88m6vsad.build_energy_totals.py", line 133, in build_eurostat
    dfs = pd.read_excel(
          ^^^^^^^^^^^^^^
  File "/home/leo/anaconda3/envs/pypsa-eur/lib/python3.11/site-packages/pandas/io/excel/_base.py", line 495, in read_excel
    io = ExcelFile(
         ^^^^^^^^^^
  File "/home/leo/anaconda3/envs/pypsa-eur/lib/python3.11/site-packages/pandas/io/excel/_base.py", line 1550, in __init__
    ext = inspect_excel_format(
          ^^^^^^^^^^^^^^^^^^^^^
  File "/home/leo/anaconda3/envs/pypsa-eur/lib/python3.11/site-packages/pandas/io/excel/_base.py", line 1402, in inspect_excel_format
    with get_handle(
         ^^^^^^^^^^^
  File "/home/leo/anaconda3/envs/pypsa-eur/lib/python3.11/site-packages/pandas/io/common.py", line 882, in get_handle
    handle = open(handle, ioargs.mode)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'data/bundle-sector/eurostat-energy_balances-june_2016_edition/2020-Energy-Balances-June2016edition.xlsx'

Not sure this is exactly the same issue, but could be adjacent?

Cheers!

fneum commented 6 months ago

This is done via #936 #947