Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Intégration Laine woolmark #831

Merged
merged 7 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion data/common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def normalization_factors(impact_defs):


def spproject(activity):
"""return the current simapro project for an activity"""
"""return the current simapro project for an activity source database"""
match activity.get("database"):
case "Ginko":
return "Ginko w/o azadirachtin"
Expand All @@ -26,6 +26,8 @@ def spproject(activity):
return "EcobalyseIsNotASimaProProject"
case "Ecoinvent 3.9.1":
return "ADEME UPR"
case "Woolmark":
return "Woolmark"
case _:
return "AGB3.1.1 2023-03-06"

Expand Down
7 changes: 6 additions & 1 deletion data/common/import_.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ def add_variant_activity(activity_data, dbname):
def import_simapro_csv(
datapath,
dbname,
external_db=None,
biosphere="biosphere3",
migrations=[],
first_strategies=[],
Expand Down Expand Up @@ -236,7 +237,11 @@ def import_simapro_csv(
database.statistics()
# try to link remaining unlinked technosphere activities
database.apply_strategy(
functools.partial(link_technosphere_by_activity_hash, fields=("name", "unit"))
functools.partial(
link_technosphere_by_activity_hash,
external_db_name=external_db,
fields=("name", "unit"),
)
)
database.apply_strategy(
functools.partial(
Expand Down
2 changes: 1 addition & 1 deletion data/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ RUN mkdir -p /home/$NB_USER/data \

# keep in sync with requirements.txt
# allow to update the image if the source repo is updated
ADD https://api.github.com/repos/ccomb/brightway2-io/git/refs/tags/ccomb-5 bw2-io.json
ADD https://api.github.com/repos/ccomb/brightway2-io/git/refs/tags/ccomb-6 bw2-io.json
ADD https://api.github.com/repos/brightway-lca/brightway2-parameters/git/refs/tags/1.1.0 bw2-parameters.json
ADD https://api.github.com/repos/brightway-lca/brightway2-data/git/refs/tags/4.0.dev42 bw2-data.json
ADD https://api.github.com/repos/brightway-lca/brightway2-calc/git/refs/tags/2.0.dev17 bw2-calc.json
Expand Down
2 changes: 1 addition & 1 deletion data/docker/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ git+https://github.com/brightway-lca/brightway2-calc@2.0.dev17
git+https://github.com/brightway-lca/brightway2-data@4.0.dev42
git+https://github.com/brightway-lca/brightway2-parameters@1.1.0
git+https://github.com/brightway-lca/bw_projects@v2.1.0
git+https://github.com/ccomb/brightway2-io@ccomb-5
git+https://github.com/ccomb/brightway2-io@ccomb-6
ipywidgets>=8.1, <8.2
jupyter-collaboration>=2.0, <2.1
matplotlib>=3.7, <3.8
Expand Down
11 changes: 11 additions & 0 deletions data/import_ecoinvent.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# Ecoinvent
EI391 = "./Ecoinvent3.9.1.CSV.zip"
EI310 = "./Ecoinvent3.10.CSV.zip"
WOOL = "./wool.CSV.zip"
BIOSPHERE = "biosphere3"
PROJECT = "default"
EXCLUDED = [
Expand Down Expand Up @@ -45,6 +46,16 @@ def main():
else:
print(f"{db} already imported")

if (db := "Woolmark") not in bw2data.databases:
import_simapro_csv(
join("..", "..", "dbfiles", WOOL),
db,
external_db="Ecoinvent 3.10", # wool is linked with EI 3.10
excluded_strategies=EXCLUDED,
)
else:
print(f"{db} already imported")


if __name__ == "__main__":
main()
26 changes: 2 additions & 24 deletions data/textile/activities.json
Original file line number Diff line number Diff line change
Expand Up @@ -496,7 +496,8 @@
{
"displayName": "Laine par défaut",
"info": "Textile > Matières > Matières naturelles",
"source": "Custom",
"source": "Woolmark",
"search": "greasy sheep wool",
"correctif": "",
"step_usage": "Matières",
"uuid": "wool-default",
Expand All @@ -512,29 +513,6 @@
"geographicOrigin": "Asie - Pacifique",
"defaultCountry": "CN",
"unit": "kg",
"impacts": {
"acd": 0.949051,
"cch": 30.5996,
"etf": 125.562,
"etf-c": 170.543,
"fru": 34.1905,
"fwe": 0.00923991,
"htc": -7.09764e-10,
"htc-c": 3.31229e-9,
"htn": -6.25711e-7,
"htn-c": 8.57317e-8,
"ior": 0.0862947,
"ldu": 2335.33,
"mru": 5.16897e-5,
"ozd": 4.86254e-8,
"pco": 0.0305717,
"pma": 6.7068e-6,
"swe": 0.158058,
"tre": 4.21086,
"wtu": 16.2801,
"ecs": 4263.098561863456,
"pef": 4646.846238265963
},
"primary": false
},
{
Expand Down
8 changes: 4 additions & 4 deletions public/data/textile/processes.json
Original file line number Diff line number Diff line change
Expand Up @@ -988,11 +988,11 @@
"alias": null
},
{
"name": "Laine par défaut",
"name": "wool; sheep; production mix; at farm; 1 kg greasy wool",
"displayName": "Laine par défaut",
"info": "Textile > Matières > Matières naturelles",
"unit": "kg",
"source": "Custom",
"source": "Woolmark",
"correctif": "",
"step_usage": "Matières",
"uuid": "wool-default",
Expand All @@ -1016,8 +1016,8 @@
"swe": 0,
"tre": 0,
"wtu": 0,
"ecs": 4263.098561863456,
"pef": 4646.846238265962
"ecs": 2781.800631273725,
"pef": 2931.4802301799327
},
"heat_MJ": 0,
"elec_pppm": 0,
Expand Down