-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missmatch between chemical formula and parameter formula #44
Comments
Hi, That's a known bug of Brightway that they have fixed in DEV/beta release but not on older versions yet. db = bw.Database("name_of_eco_db")
for act in db:
for ex in act.exchanges():
if "formula" in ex:
print(ex, ex["formula"])
del ex["formula"]
ex.save() It takes a couple of minutes, not two hours. |
BTW : the problem only happens if you have copied a background ecoinvent activity, containg chemical formulas, in your foreground and then try to freeze it : |
Hello, Thank you very much. Okay for the cleaning, I had done something similar that took too long, I will use your code ! I understand we are not supposed to freeze background database, but indeed it happen if you copy an ecoinvent activity to your foreground database and modify it but keeping old exchanges, which was my case. |
Hello,
In ecoinvent, some emissions have an attribute 'formula', which gives the chemical formula of the molecule emitted, such as 'CO2' for carbon dioxide.
When freezing a foreground database, that has some ecoinvent activities in it with such emissions, I get the error :
'TypeError: Cannot convert expression to float'
followed by
'Exception: Context : CO2'
From what I understand, freezing convert all the parameters formulas into float. But when it come accros a chemical formula, it raises an error because the parameter CO2 does not exists. So it seems that the same attribute name 'formula' is given to two distinct fields.
It is correct ? How could this be corrected ? (except renaming in ecoinvent all 'formula' field into 'chemical formula', which takes ~2 hour)
Thank you !
The text was updated successfully, but these errors were encountered: