栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

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

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

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科研的技巧,欢迎一起交流、学习、合作。

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

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/444480.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号