Skip to content

Instantly share code, notes, and snippets.

@cmutel
Created July 22, 2024 12:28
Show Gist options
  • Save cmutel/fd6528ad1f6546b3551a68e5b9effd40 to your computer and use it in GitHub Desktop.
Save cmutel/fd6528ad1f6546b3551a68e5b9effd40 to your computer and use it in GitHub Desktop.
import bw2data as bd
import bw2calc as bc
ei = bd.Database("ecoinvent-3.9.1-cutoff")
banana_co = bd.get_node(database=ei.name, name='banana production', location="CO")
banana_cr = bd.get_node(database=ei.name, name='banana production', location="CR")
impact_categories = [
('ReCiPe Endpoint (H,A)', 'ecosystem quality', 'climate change, ecosystems'),
('ReCiPe Endpoint (H,A)', 'human health', 'climate change, human health')
]
method_config = {"impact_categories": impact_categories}
# Check configuration
bc.method_config.MethodConfig(**method_config)
demands = {
'πŸ‡¨πŸ‡΄': {banana_co.id: 1},
'πŸ‡¨πŸ‡·': {banana_cr.id: 1}
}
data_objs = bd.get_multilca_data_objs(functional_units=demands, method_config=method_config)
mlca = bc.MultiLCA(
demands=demands,
method_config=method_config,
data_objs=data_objs
)
mlca.lci()
mlca.lcia()
mlca.scores
>>> {
(('ReCiPe Endpoint (H,A)', 'ecosystem quality', 'climate change, ecosystems'), 'πŸ‡¨πŸ‡΄'): 1.,
(('ReCiPe Endpoint (H,A)', 'ecosystem quality', 'climate change, ecosystems'), 'πŸ‡¨πŸ‡·'): 2.,
(('ReCiPe Endpoint (H,A)', 'human health', 'climate change, human health'), 'πŸ‡¨πŸ‡΄'): 3.,
(('ReCiPe Endpoint (H,A)', 'human health', 'climate change, human health'), 'πŸ‡¨πŸ‡·'): 4.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment