Closed cmutel closed 1 month ago
FYI @mrvisscher @jsvgoncalves @marc-vdm @tngTUDOR
See utils.py
function definition and especially the new tests to see under what conditions we add or change the type
attribute.
I totally love that we're making this more explicit and that there is a strong intention to make the distinction between products and processes even more clear in the future.
What is the implementation path? Do users need to apply this manually for their existing databases, or will you enforce it through an update or something similar?
What is the implementation path? Do users need to apply this manually for their existing databases, or will you enforce it through an update or something similar?
I think the easiest is to add something to updates
so that this is applied automatically. Please let me know if you have any strong disagreements.
This PR adds a utility function
set_correct_process_type
and applies it when writingDatabase
data. This means that every node written to the datastore will have atype
attribute (before this could be missing orNone
). We also differentiateprocess
andprocesswithreferenceproduct
nodes, and fix nodes with the typeprocess
which should beprocesswithreferenceproduct
.This PR allows for GUIs to cleanly differentiate LCI node types in their data tables. Only nodes with types
product
andprocesswithreferenceproduct
can be used as functional units (but please don't hard-code these values, usebw2data.labels.product_node_types
andbw2data.labels.chimaera_node_default
).A
processwithreferenceproduct
node is one which consumes or produces its own product - i.e. this node exists as both a row and column in the technosphere matrix. Contrast this withprocess
, which is only a column in the matrix, and consumes and producesproducts
, which are rows.Eventually we should phase out
processwithreferenceproduct
as this makes the code more complicated and prone to errors. It is much cleaner and simpler to have explicitprocess
andproduct
nodes.This is a big change and could break some code:
.write()
as it guarantees thattype
is always presentprocess
toprocesswithreferenceproduct
(e.g. all ecoinvent). Code with uses hard-coded "process" values will break. Seebw2data.configuration
for more details on labels you should expect.processwithreferenceproduct
will be checked for implicit production. This shouldn't break anything as we changeprocess
toprocesswithreferenceproduct
if implicit production was going to be added.