如何在Brightway2中获取Activity Browser桑基图式的技术/生物圈流影响结果
获取Brightway2中技术圈/生物圈流的单独影响数据
我刚接触Brightway2和Activity Browser,已在Activity Browser中创建一个简单项目并在Python IDE中使用,以理解其运作逻辑。现希望获取活动所用technosphere(技术圈流)/**biosphere(生物圈流)**的单独影响数据,如同Activity Browser桑基图(Sankey Diagramm)所展示的那样。
我的代码如下:
# importing some packages from brightway2 import * import bw2io import pandas as pd import numpy as np import matplotlib.pyplot as plt # current project is defined projects.set_current("test LCA") bw2io.bw2setup() # selecting databases for this project test=Database("test") # see which databases are already loaded print(databases.list) # selecting method EF30 = [method for method in methods if 'EF v3.0' in str(method) and not 'no LT' in str(method)and not 'EN' in str(method)] # look for activities in database print(test.search("*")) # defining the activity in the database activity = [act for act in test] act_df = pd.DataFrame() act_df['Database Process'] = test act_df['Amount'] = 1 act_df.reset_index() # Loop through all activities in the dataframe and all methods (impact categories) defined to calculate the impacts for index in act_df.index: lca = LCA({act_df['Database Process'][index]: act_df['Amount'][index]}) lca.lci() for method in EF30: lca.switch_method(method) lca.lcia() impact_cat = str(method[1]) impact_unit = str(methods[method]['unit']) header = impact_cat,'({})'.format(impact_unit) act_df.loc[index, " ".join(header)] = lca.score act_df_transposed=act_df.transpose() # write data in Excel act_df_transposed.to_excel("test.xlsx") print('DONE!')
我已查看technosphere和biosphere矩阵,但无法理解其含义。
内容的提问来源于stack exchange,提问作者squareK
相关产品推荐
相关产品推荐

