我想基于当前数据集&在非洲的铜产量,在CH'中创建一个关于铜生产的新数据集。我尝试应用以下函数,但最后一个函数返回"找不到这个位置"。有人可以帮忙吗?提前谢谢!
data = w.extract_brightway2_databases(["ecoinvent 3.4 cutoff"])
copper_production = w.contains("name", "copper production")
musuizi=w.get_one(data,w.equals('location','AU'),copper_production)
musuizi2=w.transformations.geo.copy_to_new_location(musuizi, 'CH')
w.transformations.geo.relink_technosphere_exchanges(musuizi2,data,exclusive=True, drop_invalid=False, biggest_first=False, contained=False)
答案 0 :(得分:0)
(注意:这个问题实际上是关于wurst库,而不是Brightway)
由于ecoinvent数据库和地理定义之间的同步问题,看起来有一些错误。目前,您可以执行以下操作:
import wurst as w
data = w.extract_brightway2_databases(["ecoinvent 3.4 cutoff"])
mapping = {
"ASCC": "US-ASCC",
"CSG": "CN-CSG",
"FRCC": "US-FRCC",
"HICC": "US-HICC",
"IAI Area, Africa": 'IAI Area 1, Africa',
"IAI Area, Asia, without China and GCC": 'IAI Area 4&5, without China',
"IAI Area, Gulf Cooperation Council": 'IAI Area 8, Gulf',
"IAI Area, North America, without Quebec": 'IAI Area 2, without Quebec',
"IAI Area, Russia & RER w/o EU27 & EFTA": 'IAI Area, Europe outside EU & EFTA',
"IAI Area, South America": 'IAI Area 3, South America',
"MRO, US only": "US-MRO",
"NPCC, US only": "US-NPCC",
"RFC": "US-RFC",
"SERC": "US-SERC",
"SGCC": "CN-SGCC",
"SPP": "US-SPP",
"TRE": "US-TRE",
"WECC, US only": "US-WECC",
}
def update_all_locations(data):
for ds in data:
ds['location'] = mapping.get(ds['location'], ds['location'])
update_all_locations(data)
copper_in_au = w.get_one(data, w.equals('location','AU'), w.contains("name", "copper production"))
copper_in_ch = w.transformations.geo.copy_to_new_location(copper_in_au, 'CH')
data.append(copper_in_ch)
w.transformations.geo.relink_technosphere_exchanges(
copper_in_ch,
data,
contained=False
)