我想知道如何在brightway2中使用transverse_tagged_database方法。从文档中我并不完全清楚。例如,我们可以使用产品系统模型中活动的 isic 代码来汇总影响吗?
1 回答
简短的回答是肯定的,在您的前台产品系统模型中聚合 ISIC 代码的影响正是您可以使用traverse_tagged_databases
.
traverse_tagged_databases 函数利用了这样一个事实,即您可以将任意key:value
对添加到brightway 中的活动中,以便您根据自己的喜好对前景模型中的活动进行分类。
例如,假设您的活动如下所示:
('example_database', 'code_for_bread'):{
'name': 'Bread',
'code': 'code_for_bread',
'categories':[],
'exchanges':[...],
'location':'GLO'
'unit':'kg',
'database':'example_database',
'isic_code':'1071'
'isic_classifier':'Manufacture of bakery products'
},
例如,您可以告诉您traverse_tagged_databases
通过数据库查找给定的键(标签),'isic_code'
或者'isic_classifier'
根据这些标签汇总影响。
假设您正在为奶酪三明治建模,您的模型中可能包含以下 ISIC 代码:
三明治:1079(其他食品制造除外)
面包:1071(烘焙产品制造)
奶酪:1050(乳制品制造)
黄油:1050(乳制品制造)
您可以使用traverse_tagged_databases
查看乳制品(奶酪和黄油)与面包店(面包)的总体影响。
您可以以与函数类似的方式使用它,将LCA
功能单元指定为 adict
并将方法指定为 a tuple
,并带有附加tag
参数。像这样:
fu = {('example_database', 'code_for_sandwich'):1}
m = ('IPCC 2013', 'climate change', 'GWP 100a')
result, tree = traverse_tagged_databases(fu, m, 'isic_classifier')
该函数返回两个对象(在上面result
的tree
行中指定)
对于此分析,您result
将如下所示:
defaultdict(int,
{'Manufacture of other food products n.e.c.': 0,
'Manufacture of bakery products': 0.1875,
'Manufacture of dairy products': 0.55})
也就是说,前景模型中的乳制品的总影响为 0.55 kg CO2-eq,烘焙产品的总影响为 0.1875 kg CO2-eq。
通过一些后期处理,您可以将这些数据转换为饼图、堆叠条形图等。
您还会得到一个tree
,如下所示:
[{'activity': 'Sandwich' (kg, GLO, []),
'amount': 1,
'tag': 'Manufacture of other food products n.e.c.',
'impact': 0,
'biosphere': [],
'technosphere': [{'activity': 'Bread' (kg, GLO, []),
'amount': 0.75,
'tag': 'Manufacture of bakery products',
'impact': 0,
'biosphere': [{'amount': 0.1875,
'impact': 0.1875,
'tag': 'Manufacture of bakery products'}],
'technosphere': []},
{'activity': 'Butter' (kg, GLO, []),
'amount': 0.05,
'tag': 'Manufacture of dairy products',
'impact': 0,
'biosphere': [{'amount': 0.05,
'impact': 0.05,
'tag': 'Manufacture of dairy products'}],
'technosphere': []},
{'activity': 'Cheese' (kg, GLO, []),
'amount': 0.25,
'tag': 'Manufacture of dairy products',
'impact': 0,
'biosphere': [{'amount': 0.5,
'impact': 0.5,
'tag': 'Manufacture of dairy products'}],
'technosphere': []}]}]
起初这看起来有点难以解析,但本质上是一组嵌套字典,从根活动(功能单元 = Sandwich)开始,显示techosphere
与其他活动的biosphere
交换,以及与排放的交换。
这里的树看起来像这样(amount
每个产品的 s 在括号中)
Bread +----(0.75 kg)----------+
|
|
|
|
Cheese +----(0.20 kg)----------+------(1.00 kg)--------> Sandwich
|
|
|
|
Butter +----(0.05 kg)----------+
同样,通过一些后期处理,您可以将这些数据转换为像桑基图这样的东西,或者您在 SimaPro 中获得的那种影响树图。