pypsa-eur icon indicating copy to clipboard operation
pypsa-eur copied to clipboard

update reading eurostat data to recent years

Open martavp opened this issue 4 years ago • 1 comments

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)

martavp avatar Dec 30 '20 15:12 martavp

This is tackled in branch multiyear to eurostat June 2021

fneum avatar Jul 25 '22 19:07 fneum

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!

LRydin avatar Mar 29 '24 09:03 LRydin

This is done via #936 #947

fneum avatar May 12 '24 16:05 fneum