To really understand what is going on, it is useful to understand the difference between "intermediate" data (stored as structured text files) and "processed" data (stored as numpy structured arrays). These concepts are described both here and here.
However, to answer your question directly: what each row and column stand for in the different matrices and arrays (e.g. lca.inventory
matrix, lca.supply_array
, lca.characterized_inventory
) are contained in a set of dictionaries that are associated with your LCA
object. These are:
activity_dict
: Columns in the technosphere matrix
product_dict
: Rows in the technosphere matrix
biosphere_dict
: Rows in the biosphere matrix
For example, lca.product_dict
yields, in the case of an LCA I just did:
{('ei32_CU_U', '671c1ae85db847083176b9492f000a9d'): 8397,
('ei32_CU_U', '53398faeaf96420408204e309262b8c5'): 536,
('ei32_CU_U', 'fb8599da19dabad6929af8c3a3c3bad6'): 7774,
('ei32_CU_U', '28b3475e12e4ed0ec511cbef4dc97412'): 3051, ...}
with the key
in the dictionary being the actual product in my inventory database and the value
is the row in the demand_array
or the supply_array
.
More useful may be the reverse of these dictionaries. Let's say you want to know what a value in e.g. your supply_array
refers to, you can create a reverse dictionary using a dict comprehension :
inv_product_dict = {v: k for k, v in lca.product_dict.items()}
and then simply use it directly to obtain the information you are after. Say you want to know what is in the 10th row of the supply_array
, you can simply do inv_product_dict[10]
, which in my case yields ('ei32_CU_U', '4110733917e1fcdc7c55af3b3f068c72')
The same types of logic applies with biosphere (or elementary) flows, found in the lca.biosphere_dict
(in LCA parlance, rows in the B matrix), and activities, found in the lca.activity_dict
(columns of the A or B matrices).
Note that you can generate the reverse of the activity_dict/product_dict/biosphere_dict simultaneously using lca.reverse_dict()
. The syntax then is:
rev_act_dict, rev_product_dict, rev_bio_dict = lca.reverse_dict()