-
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
Failure when using activities with biosphere exchanges #39
Comments
Hi, Normally, when stumbling upon biosphere flux, the library creates a dummy activity in the technosphere with a single biosphere flux, in order to be able to ask LCIA impact for it to brightway. This is done in the method _createTechProxyForBio that checks the db name is "biosphere3" or that the its type is either "emission" or "natural resource". Also, please ensure that only a single database is marked as foreground, and that neither ecoinvent or the biosphere are marked as foreground db. See setForeground and setBackground |
Hi, Thank you for answering. I am working with an LCA that has some activities that are adapted from ecoinvent, and in the biosphere flows have the "formula" field filled with its chemical formula. They are in the only foreground DB in this project. I have the code failing in actToExpression inside _modelToExpr, so before _createTechProxyForBio is called. The expression that is being built is based on the chemical formulas, which are seen as parameters. I see that in bw2.5, for elementary flows, the "formula" field is correctly assigned to the mathematical relationship, and there is another field "chemical formula", but not in bw2. Best regards, |
This kind of error is usually catched and ignored : See :
|
Yes, I get these warnings, and then it fails in: res += formula * act_expr * avoidedBurden with at this point, formula is "S". _parse_formula is able to parse a few of the chemical formulas as mathematical formulas and is creating the expression using those. |
Ok, I never encountered this case. Biosphere formulate were catched by this mecanism before. Then I guess you fix is a good one ! |
Yes, with that fix everything works fine for me. |
Then thanks for this feedback. Have a good day. |
For the record, I won't include this fix in the main branch, since it make impossible to parametrize biosphere flux with formulas. |
When working with an LCA model on which there are exchanges directly with the biosphere, lca_algebraic fails due to the "formula" field, that means something else.
Changing, in, _getAmountOrFormula, the line
if "formula" in ex :
for
if "formula" in ex and ex["type"] != "biosphere":
solves it for me.
Is there another way of handling activities like this, or this is one right solution?
Thank you.
Simão Rodrigues
The text was updated successfully, but these errors were encountered: