Search code examples
brightway

Strange result when searching in ecoinventdb through BW2


I am a Brightway2 beginner. A result has complicated my life for a few weeks now and I can't find any solutions. I've dealt with it by various tricks but I would still like to understand this problem: when I search in my database for an activity with the name "glazing" for example, I get activities like "phenol", "polysulfide production"... Even if I look at the description of these activities, I don't understand (and this complicates my life a little). (db = ecoinvent 3.6) Any ideas? Maybe this is not the right place for this kind of question... Thank you in advance. Jean

code:
activity_name = 'glazing'
myProducts = []

for activity in Database("ecoinvent 3.6 APOS").search(activity_name, filter={"location" : 'RER'}): 
    myProducts.append(activity)
myProducts

out:

['glazing production, triple, U<0.5 W/m2K' (square meter, RER, None),
 'glazing production, double, U<1.1 W/m2K' (square meter, RER, None),
 'glazing production, double, U<1.1 W/m2K, laminated safety glass' (square meter, RER, None),
 'polysulfide production, sealing compound' (kilogram, RER, None),
 'phenol production' (kilogram, RER, None),
 'phenol production' (kilogram, RER, None),
 'methacrylic acid production' (kilogram, RER, None)]

Solution

  • Search is working as intended: You are looking for the term glazing, and it shows up in all the given results. For example the comment to polysulfide production has the sentence:

    This dataset is primarily used in the glazing production.
    

    If you only want activities with glazing in the title:

    only_glazing = [ds for ds in Database("something") if 'glazing' in ds['name']]
    

    You could also test against ds['name'].lower() to get case independence.

    In general, searching with list comprehensions is going to produce more sensible results than .search, which is more for data exploration.