Skip to content

Commit 45bf6bd

Browse files
committed
2 parents 15c6018 + c505750 commit 45bf6bd

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

ecoinvent_migrate/data_io.py

+14-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111

1212
def get_change_report_filepath(version: str, release: EcoinventRelease) -> Path:
13-
"""Get the filepath to the Excel change report file"""
13+
"""Get the filepath to the Excel change report file.
14+
15+
Download a list of extra files from ecoinvent and do pattern matching."""
1416
files = release.list_extra_files(version)
1517
candidates = [key for key in files if "change report" in key.lower() and "annex" in key.lower()]
1618
if not candidates:
@@ -59,6 +61,7 @@ def setup_project(
5961
ecoinvent_username: Optional[str] = None,
6062
ecoinvent_password: Optional[str] = None,
6163
) -> None:
64+
"""Switch to or create a Brightway project, and install the source and target databases."""
6265
bd.projects.set_current(project_name)
6366

6467
if f"ecoinvent-{source_version}-{system_model}" not in bd.databases:
@@ -90,6 +93,16 @@ def setup_project(
9093

9194

9295
def get_brightway_databases(source_version: str, target_version: str, system_model: str):
96+
"""Get database names and process caches for source and target databases.
97+
98+
Returns:
99+
100+
* `source_db_name`: str. Standardized name for ecoinvent based on `ecoinvent_interface` standard
101+
* `target_db_name`: str. Standardized name for ecoinvent based on `ecoinvent_interface` standard
102+
* `source_lookup`: dict. Dictionary from attribute tuple (name, location, reference product) to `Node` object.
103+
* `target_lookup`: dict. Dictionary from attribute tuple (name, location, reference product) to `Node` object.
104+
105+
"""
93106
source_db_name = f"ecoinvent-{source_version}-{system_model}"
94107
target_db_name = f"ecoinvent-{target_version}-{system_model}"
95108
if source_db_name not in bd.databases:

ecoinvent_migrate/wrangling.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ def isnan(o: Union[str, Number]) -> bool:
1414

1515

1616
def split_by_semicolon(row: dict, version: str) -> list[dict]:
17-
"""Possible split a data row into"""
17+
"""Turn a data `row` into one or more dictionaries.
18+
19+
Splits reference product and unit values by `;\n`."""
1820
if isinstance(row[f"Activity Name - {version}"], Number) and math.isnan(
1921
row[f"Activity Name - {version}"]
2022
):

0 commit comments

Comments
 (0)