-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
109 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Map from the context terms used in LCIA and metadata to the terms used in unit processes | ||
CONTEXT_MAPPING = { | ||
"Non material emissions": "Non material emissions", | ||
"Airborne emissions": "Emissions to air", | ||
"Waterborne emissions": "Emissions to water", | ||
"Raw materials": "Resources", | ||
"Final waste flows": "Final waste flows", | ||
"Emissions to soil": "Emissions to soil", | ||
"Social issues": "Social issues", | ||
"Economic issues": "Economic issues", | ||
} | ||
|
||
MAGIC = " ⧺ " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import itertools | ||
import re | ||
from collections.abc import Iterator | ||
from typing import List | ||
import re | ||
|
||
import ftfy | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
from bw_simapro_csv.blocks import GenericBiosphere, Process | ||
|
||
|
||
def test_supplement_biosphere_edges(): | ||
class O: | ||
pass | ||
|
||
class P(Process): | ||
def __init__(self): | ||
pass | ||
|
||
class B(GenericBiosphere): | ||
def __init__(self): | ||
pass | ||
|
||
o = O() | ||
o.category = "Emissions to air" | ||
o.parsed = [ | ||
{"name": "first", "data": "yes please"}, | ||
{"name": "second", "unit": "something", "comment": "already here"}, | ||
{ | ||
"name": "third", | ||
"lonely": True, | ||
}, | ||
] | ||
|
||
p = P() | ||
p.blocks = {"Emissions to air": o} | ||
|
||
b = B() | ||
b.category = "Airborne emissions" | ||
b.parsed = [ | ||
{"name": "first", "cas_number": True}, | ||
{"name": "second", "comment": "this"}, | ||
{"name": "third", "comment": "hi mom"}, | ||
] | ||
|
||
expected = [ | ||
{ | ||
"name": "first", | ||
"data": "yes please", | ||
"cas_number": True, | ||
}, | ||
{"name": "second", "unit": "something", "comment": "already here ⧺ this"}, | ||
{ | ||
"name": "third", | ||
"lonely": True, | ||
"comment": "hi mom", | ||
}, | ||
] | ||
|
||
p.supplement_biosphere_edges([b]) | ||
assert p.blocks["Emissions to air"].parsed == expected |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters