database上的'location'过滤器过滤所有内容

时间:2016-04-20 20:57:58

标签: brightway

我已将ecoinvent数据库导入为-Wl,--end-group

搜索功能非常有效:

ei

这正是人们所希望的。

但是,对In[0] eidb.search("glass", filter = {'name':'green', 'product':'packaging' } ) Excluding 296 filtered results Out[0]: ['packaging glass production, green' (kilogram, RER w/o CH+DE, None), 'packaging glass production, green' (kilogram, DE, None), 'packaging glass production, green' (kilogram, RoW, None), 'packaging glass production, green' (kilogram, CH, None), 'packaging glass production, green, without cullet' (kilogram, GLO, None), 'market for packaging glass, green' (kilogram, GLO, None)] 进行过滤效果不佳:

'location'

根据上述结果,我应该至少有两个结果。 In[1] eidb.search("glass", filter = {'location':'DE', } ) Excluding 304 filtered results Out[1]: [] 绝对是一个被接受的过滤器,DE肯定是其中一个位置(例如'location'返回DE)。

我随时将位置用作过滤器,例如eidb.get('d2db85e14baf9e47bdbb824797420f08').get('location')返回一个空列表。

为什么呢?

3 个答案:

答案 0 :(得分:0)

I have no idea why this is occurring, but you can get the behaviour you are looking for by putting the location code in lowercase:

In [1]: db.search("glass", filter={"location": "de"})
Excluding 103 filtered results
Out[1]:
['glass tube plant' (unit, DE, ['glass', 'construction']),
 'glass tube, borosilicate, at plant' (kilogram, DE, ['glass', 'construction']),
 'packaging glass, white, at plant' (kilogram, DE, ['glass', 'packaging']),
 'packaging glass, brown, at plant' (kilogram, DE, ['glass', 'packaging']),
 'packaging glass, green, at plant' (kilogram, DE, ['glass', 'packaging']),
 'solar collector glass tube, with silver mirror, at plant' (kilogram, DE, ['glass', 'construction']),
 'photovoltaic laminate, CdTe, at plant' (square meter, DE, ['photovoltaic', 'production of components'])]

Please file this as a bug for bw2data.

答案 1 :(得分:0)

可能你已经注意到了,但对于魁北克的情况,仅使用最后一部分就可以了(例如eidb.search('*', filter = {'location':'qc'}))。我已经检查过,并且在ecoinvent中没有位置代码为QC的地区,因此不存在包含其他地区活动的风险。

答案 2 :(得分:0)

问题似乎不仅仅在于大写和 punctuation characters

ei.search('photovoltaic laminate, CdTe',
          filter={"location": "US"} 
         )
Excluding 7 filtered results
[]

P.S: 很奇怪,但在这种情况下 filter={"location": "DE"} 也用大写找到正确的数据集