I have a scientific model that I run in Python that creates a lookup table as output. That is, he creates a multidimensional βtableβ, where each dimension is a parameter in the model, and the value in each cell is the output of the model.
My question is how best to store this lookup table in Python. I run the model in a cycle of all possible combinations of parameters (using a fantastic function itertools.product), but I canβt decide what is the best way to save the outputs.
It would seem reasonable to just save the output as ndarray, but I would really like to have access to the outputs based on parameter values, and not just indexes. For example, instead of referring to values ββas table[16][5][17][14], I prefer to access them in some way using variable names / values, for example:
table[solar_z=45, solar_a=170, type=17, reflectance=0.37]
or something like that. It would be great if I could iterate over the values ββand return their parameter values, i.e. Detect what table[16]...matches the outputs for solar_z = 45.
Is there any reasonable way to do this in Python?
source
share