Skip to content

Commit

Permalink
Fix uncertainty data in LCIs
Browse files Browse the repository at this point in the history
  • Loading branch information
romainsacchi authored and romainsacchi committed Aug 8, 2024
1 parent 1437470 commit c65cee0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion premise/transformation.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def redefine_uncertainty_params(old_exc, new_exc):

elif old_exc.get("uncertainty type") == 2:
return (
math.log(new_exc["amount"]),
math.log(new_exc["amount"] * -1) if new_exc["amount"] < 0 else math.log(new_exc["amount"]),
old_exc.get("scale"),
None,
None,
Expand Down
11 changes: 11 additions & 0 deletions premise/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,17 @@ def check_uncertainty(self):
)
self.log_issue(ds, "incomplete uncertainty data", message)

if exc.get("uncertainty type", 0) == 2 and "loc" not in exc:
exc["loc"] = math.log(exc["amount"])

if exc.get("uncertainty type", 0) == 3 and "loc" not in exc:
exc["loc"] = exc["amount"]

if exc.get("uncertainty type", 0) == 5 and "loc" not in exc:
exc["loc"] = exc["amount"]



def check_datasets_integrity(self):
# Verify no unintended loss of datasets
original_activities = [
Expand Down

0 comments on commit c65cee0

Please sign in to comment.