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

feat: Intégration Laine woolmark #831

merged 7 commits into from
Nov 18, 2024

Conversation

ccomb
Copy link
Collaborator

@ccomb ccomb commented Nov 18, 2024

🔧 Problem

We got new more robust LCI data for wool.

🍰 Solution

Implement the new wool data: import into brightway, generate an export (still using simapro data)

There is a new external_db option is the toplevel common.import_.import_simapro_csv function to link the new activities to an existing db. It's transmitted as is to the link_technosphere_by_activity_hash strategy. This is because the new wool data is created using EI 3.10 as a library in SimaPro, so we have to import EI3.10 first then link to it.

🏝️ How to test

Get the new wool.CSV.zip data, import the wool using make import_ecoivent then rebuild the image make image and do an export with make export_textile and check there is no diff.
Check the new cool is one third below the previous one in terms of impacts.

ecobalyse-data: laine_woolmark

@paulboosz
Copy link
Collaborator

I have this error :

ecobalyse@ecobalyse:~/ecobalyse/data$ make import_ecoinvent
Error response from daemon: No such container: ecobalyse
ECOBALYSE_DATA_DIR=/home/ecobalyse/ecobalyse-private
ECOBALYSE_DATA_DIR=/home/ecobalyse/ecobalyse-private
(Creating a new container)
Using environment variable BRIGHTWAY2_DIR for data directory:
/home/jovyan/data
Biosphere database already present!!! No setup is needed
Ecoinvent 3.9.1 already imported
Ecoinvent 3.10 already imported
### Importing ../../dbfiles/./wool.CSV.zip...
### Extracting the zip file...
### Importing into Woolmark...
Extracted 3 unallocated datasets in 0.01 seconds
### Applying migrations...
3 datasets
78 exchanges
78 unlinked exchanges
  Type biosphere: 35 unique unlinked exchanges
  Type production: 4 unique unlinked exchanges
  Type technosphere: 26 unique unlinked exchanges
### Applying strategies...
Applying strategy: normalize_units
Applying strategy: update_ecoinvent_locations
Applying strategy: assign_only_product_as_production
Applying strategy: drop_unspecified_subcategories
Applying strategy: sp_allocate_products
Traceback (most recent call last):
  File "/home/jovyan/ecobalyse/data/import_ecoinvent.py", line 61, in <module>
    main()
  File "/home/jovyan/ecobalyse/data/import_ecoinvent.py", line 50, in main
    import_simapro_csv(
  File "/home/jovyan/ecobalyse/data/common/import_.py", line 236, in import_simapro_csv
    database.apply_strategies()
  File "/opt/conda/lib/python3.11/site-packages/bw2io/importers/base.py", line 126, in apply_strategies
    self.apply_strategy(func, verbose)
  File "/opt/conda/lib/python3.11/site-packages/bw2io/importers/base.py", line 92, in apply_strategy
    self.data = strategy(self.data)
                ^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/site-packages/bw2io/strategies/simapro.py", line 106, in sp_allocate_products
    interp = bw2parameters.ParameterSet(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/site-packages/bw2parameters/parameter_set.py", line 34, in __init__
    self.order = self.get_order()
                 ^^^^^^^^^^^^^^^^
  File "/opt/conda/lib/python3.11/site-packages/bw2parameters/parameter_set.py", line 60, in get_order
    raise CapitalizationError(
bw2parameters.errors.CapitalizationError: Possible errors in upper/lower case letters for some parameters.
Unmatched references:
{ 'lamb_alloc': {'LAMB_SALES', 'TOTAL_SALES'},
  'total_sales': {'LAMB_SALES', 'WOOL_SALES'},
  'wool_alloc': {'WOOL_SALES', 'TOTAL_SALES'}}
Matched references:
[ 'ArithmeticError',
  'AssertionError',

Copy link
Collaborator

@paulboosz paulboosz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Work for me :) Congrats @ccomb

@ccomb ccomb merged commit ca8a987 into master Nov 18, 2024
8 checks passed
@ccomb ccomb deleted the laine_woolmark branch November 18, 2024 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants