From b5c946987e097f0119841c29e438ee7781d09166 Mon Sep 17 00:00:00 2001 From: "Miguel F. Astudillo" Date: Sat, 10 Oct 2020 16:47:36 +0200 Subject: [PATCH] filter non-defined elementary flows --- presamples/loader.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/presamples/loader.py b/presamples/loader.py index 126d886..f3be509 100644 --- a/presamples/loader.py +++ b/presamples/loader.py @@ -275,10 +275,13 @@ def update_matrices(self, lca=None, matrices=None, advance_indices=True): elem['indices'][elem['col to label']], ] = sample else: + # filter elementary flows not in database + mask = np.isin(elem['indices'][elem['row to label']],matrix.indices) + existing = elem['indices'][elem['row to label']][mask] matrix[ - elem['indices'][elem['row to label']], - elem['indices'][elem['row to label']], - ] = sample + existing, + existing, + ] = sample[mask] def update_package_indices(self): """Move to next index"""