mescal.change_ecoinvent
Functions
|
Change the name of the database in the mapping file |
Change the version of the ecoinvent database in the mapping file |
|
|
Concatenate change reports annexes of the ecoinvent database |
|
Handle multi-processes activities in the ecoinvent change report annex |
|
Load the change report annex between two versions of the ecoinvent database |
Load the concatenated change report between two versions of the ecoinvent database |
|
|
Update the mapping file with the concatenated change report |
|
Adapt the unit conversion file according to the possible unit changes in the mapping file |
Module Contents
- mescal.change_ecoinvent.change_database_name_in_mapping_file(row: pandas.Series, version_from: str, version_to: str, name_complementary_db: str = None) pandas.Series[source]
Change the name of the database in the mapping file
- Parameters:
row (pandas.Series) – row of the mapping file
version_from (str) – initial version of the ecoinvent database
version_to (str) – target version of the ecoinvent database
name_complementary_db (str) – name of the complementary database
- Returns:
updated row
- Return type:
pandas.Series
- mescal.change_ecoinvent.change_ecoinvent_version_mapping(mapping: pandas.DataFrame, v_from: str, v_to: str, name_complementary_db: str = None) tuple[pandas.DataFrame, [tuple[str, str], tuple[str, str, str], str, str]][source]
Change the version of the ecoinvent database in the mapping file
- Parameters:
mapping (pandas.DataFrame) – mapping between the LCI datasets and the ESM technologies
v_from (str) – initial version of the ecoinvent database
v_to (str) – target version of the ecoinvent database
name_complementary_db (str) – name of the complementary database
- Returns:
updated mapping, list of tuples with unit changes
- Return type:
tuple[pandas.DataFrame, [tuple[str, str], tuple[str, str, str], str, str]]
- mescal.change_ecoinvent.concatenate_change_reports(v_from: str, v_to: str) pandas.DataFrame[source]
Concatenate change reports annexes of the ecoinvent database
- Parameters:
v_from (str) – initial version of the ecoinvent database
v_to (str) – final version of the ecoinvent database
- Returns:
concatenated change report annex as a pandas DataFrame
- Return type:
pandas.DataFrame
- mescal.change_ecoinvent.handle_multi_processes_ecoinvent(df: pandas.DataFrame) pandas.DataFrame[source]
Handle multi-processes activities in the ecoinvent change report annex
- Parameters:
df (pandas.DataFrame) – dataframe of the concatenated change report annex
- Returns:
updated dataframe with multi-processes activities separated
- Return type:
pandas.DataFrame
- mescal.change_ecoinvent.load_change_report_annex(v_from: str, v_to: str) pandas.DataFrame[source]
Load the change report annex between two versions of the ecoinvent database
- Parameters:
v_from (str) – initial version of the ecoinvent database
v_to (str) – next version of the ecoinvent database
- Returns:
change report annex as a pandas DataFrame
- Return type:
pandas.DataFrame
- mescal.change_ecoinvent.load_concatenated_ecoinvent_change_report(v_from: str, v_to: str) pandas.DataFrame[source]
Load the concatenated change report between two versions of the ecoinvent database
- Parameters:
v_from (str) – initial version of the ecoinvent database
v_to (str) – next version of the ecoinvent database
- Returns:
concatenated change report as a pandas DataFrame
- Return type:
pandas.DataFrame
- mescal.change_ecoinvent.update_mapping_file(mapping: pandas.DataFrame, change_report: pandas.DataFrame, unit_to_change: list = None) tuple[pandas.DataFrame, int, [tuple[str, str], tuple[str, str, str], str, str]][source]
Update the mapping file with the concatenated change report
- Parameters:
mapping (pandas.DataFrame) – mapping between the LCI datasets and the ESM technologies
change_report (pandas.DataFrame) – concatenated change report between two versions of the ecoinvent database
unit_to_change (list) – list of tuples in case a unit change has been detected
- Returns:
updated mapping, number of changes, list of tuples with unit changes
- Return type:
tuple[pandas.DataFrame, int, [tuple[str, str], tuple[str, str, str], str, str]]
- mescal.change_ecoinvent.update_unit_conversion_file(unit_conversion: pandas.DataFrame, unit_changes: list, new_unit_conversion_factors: dict) pandas.DataFrame[source]
Adapt the unit conversion file according to the possible unit changes in the mapping file
- Parameters:
unit_conversion (pandas.DataFrame) – file with unit conversion factors
unit_changes (list) – list of tuples with unit changes
new_unit_conversion_factors (dict) – dictionary with new unit conversion factors
- Returns:
updated unit conversion file
- Return type:
pandas.DataFrame