Python生命周期分析: Brightway2 报错unlink exchange的调试方法

Python生命周期分析: Brightway2 报错unlink exchange的调试方法,第1张

Python生命周期分析: Brightway2 报错unlink exchange的调试方法

点赞发Nature
关注中Science

用brightway2和构建基于excel的生命周期数据库时,常出现一下报错

link = r"pathtodatabase.xlsx"
db = bw.Excelimporter(link)
db.apply_strategies()
db.match_database(
    db_name="ecoinvent 3.6",
    fields=["name", "unit", "location", ],
)
db.statistics()

> Extracted 1 worksheets in 0.02 seconds
> Applying strategy: csv_restore_tuples
> Applying strategy: csv_restore_booleans
> Applying strategy: csv_numerize
> Applying strategy: csv_drop_unknown
> Applying strategy: csv_add_missing_exchanges_section
> Applying strategy: normalize_units
> Applying strategy: normalize_biosphere_categories
> Applying strategy: normalize_biosphere_names
> Applying strategy: strip_biosphere_exc_locations
> Applying strategy: set_code_by_activity_hash
> Applying strategy: link_iterable_by_fields
> Applying strategy: assign_only_product_as_production
> Applying strategy: link_technosphere_by_activity_hash
> Applying strategy: drop_falsey_uncertainty_fields_but_keep_zeros
> Applying strategy: convert_uncertainty_types_to_integers
> Applying strategy: convert_activity_parameters_to_list
> Applied 16 strategies in 0.33 seconds
> Applying strategy: link_iterable_by_fields
> Writing activities to SQLite3 database:
> 6 datasets
> 24 exchanges
> 15 unlinked exchanges
  Type technosphere: 15 unique unlinked exchanges


此时,我们可以查看到底时那些exchange未连接,使用以下语句可以到相应路径下查看输出excel,找到unlink exchanges,做相应的调试

db.write_excel()
db.write_database()


> Wrote matching file to:
> AppDataLocalpylcaBrightway3SOFC.6b6e45b646d3f7510875adf749c4e552outputdatabase.xlsx

————————
我是仁荷大学的博士生(我的google scholar, 我的Github),关注能源转型过程中的环境、经济问题。

专注于分享利用python科研的技巧,欢迎一起交流、学习、合作。

关于我的博客内容、其他相关的研究问题,有问题可以下方评论、或私信我~

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5157795.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-18
下一篇 2022-11-18

发表评论

登录后才能评论

评论列表(0条)

保存