pipelines

The pipelines module is the main module of ecodynelec. It consists in a collection of high-level functions triggering processes intricating most of the functions of the package.

This module contains:
  • execute: whole process from downloading / loading the data to the computation of impacts

  • get_inverted_matrix: process from downloading to track the electricity.

  • localize_from_utc: shifts the time-zone from results.

ecodynelec.pipelines.execute(config, missing_mapping='error', is_verbose=False, progress_bar: ProgressInfo | None = None)[source]

Executes the whole computation process, i.e. (1) downloads required data; (2) load auxiliary data; (3) load and correct Entso-E data; (4) compute the electricity tracking; (5) computes the environmental impacts; (6) save and return.

This function only returns the impacts of the electricity mix of the target countries (the intermediate results, relative mixes and mixes of production in kWh aren’t saved or returned). See get_prod_mix_impacts() or get_inverted_matrix() for a function returning all the intermediate results.

Parameters:
  • config (ecodynelec.Parameter or str) – a set of configuration parameters to govern the computation, either as Parameter object or str pointing at a xlsx file.

  • missing_mapping (str, default to ‘error’) – strategy for handling producing units with not mapping. ‘error’ (default) raises an error, ‘worst’ takes the highest impact value in the available set, ‘unit’ takes the highest impact value available from a similar unit type, defaults to ‘error’

  • is_verbose (bool, default to False) – To display progress information

  • progress_bar (ProgressInfo, default to None) – A progress bar to display the progress of the computation

Returns:

a collection of tables containing the dynamic impacts of 1kWh of electricity Note if there are multiple target countries, the data is returned in a dict of each target’s impacts.

Return type:

dict of pd.DataFrame or dict of dict of pd.DataFrame

ecodynelec.pipelines.get_inverted_matrix(config, is_verbose=False, progress_bar: ProgressInfo | None = None)[source]

Triggers the computation process until the electricity tracking to return the electricity mix in all involved countries. No data saving is involved. For CH, the local residual is not added to the mix, even is enabled.

Parameters:
  • config (ecodynelec.Parameter or str) – a set of configration parameters to govern the computation, either as Parameter object or str pointing at a xlsx file.

  • is_verbose (bool, default to False) – To display progress information

  • progress_bar (ProgressInfo, default to None) – A progress bar to display the progress of the computation

Returns:

mix_matrix – A collection of tables containing the decomposition of 1kWh of electricity

Return type:

list of pandas.DataFrame

ecodynelec.pipelines.get_prod_mix_impacts(config, step_imp_memory, missing_mapping='error', is_verbose=False, progress_bar: ProgressInfo | None = None)[source]

Executes the whole computation process, i.e. (1) downloads required data; (2) load auxiliary data; (3) load and correct Entso-E data; (4) compute the electricity tracking; (5) computes the environmental impacts; (6) save and return.

This function returns: - the impacts of the electricity production mix of the target countries - the impacts of the electricity consumer mix of the target countries (returned by execute()) - the intermediate results, relative mixes per target country and total production/imports/exports in kWh

Parameters:
  • config (ecodynelec.Parameter or str) – a set of configration parameters to govern the computation, either as Parameter object or str pointing at a xlsx file.

  • step_imp_memory (dict) – dictionnary containing the last STEP impact of the last year

  • missing_mapping (str, default to ‘error’) – strategy for handling producing units with not mapping. ‘error’ (default) raises an error, ‘worst’ takes the highest impact value in the available set, ‘unit’ takes the highest impact value available from a similar unit type, defaults to ‘error’

  • is_verbose (bool, default to False) – To display progress information

  • progress_bar (ProgressInfo, default to None) – A progress bar to display the progress of the computation

Returns:

  • raw_prod_dict (pd.DataFrame or dict of pd.DataFrame) – A table containing the production, in kWh, for each electricity source for the target country (local and import sources). Note if there are multiple target countries, the data is returned in a dict of each target’s production table

  • prod_dict (pd.DataFrame or dict of pd.DataFrame) – A table containing the relative production mix of the target country, in %, for each production source (only local sources). Note if there are multiple target countries, the data is returned in a dict of each target’s mix table.

  • mix_dict (pd.DataFrame or dict of pd.DataFrame) – A table containing the relative consumption mix of the target country, in %, for each production source (local and import sources). Note if there are multiple target countries, the data is returned in a dict of each target’s mix table.

  • prod_imp_dict (dict of pd.DataFrame or dict of dict of pd.DataFrame) – A collection of tables containing the dynamic impacts of the production of 1kWh of electricity in the target country. Note if there are multiple target countries, the data is returned in a dict of each target’s impacts.

  • imp_dict (dict of pd.DataFrame or dict of dict of pd.DataFrame) – A collection of tables containing the dynamic impacts of 1kWh of consumed electricity in the target country. Note if there are multiple target countries, the data is returned in a dict of each target’s impacts.

  • step_imp_memory (dict containing the last STEP impact of the last year)