Open ccomb opened 1 year ago
Hi @ccomb,
Thanks again for this error analysis. I believe the best way to go here is to have a renaming strategy (in bw2io) for the Agribalyse importer. For example, the strategy could go through the data, and rename parameters names yield
to Yield
, yields
, crop_yield
...
Ben
Thanks,
I've looked at asteval
, there is hardcoded list of names considered as operators or internal names. Maybe it could be used during the parsing phase?
Agribalyse 3.1.1 contains Input parameters and formulas which use the
yield
keyword as a variable (such as a grain yield) :Example from line 2348611 of the Simapro CSV export of AGB 3..1:
This data leads to a ValueError in the basic_validation() when the Simapro extractor tries to parse the data;
The intended import procedure is the same as in https://github.com/sc-gcoste/brightway-agribalyse3.1/blob/master/build_agb3.1_database.ipynb
The easiest operational solution is to modify the input data to rename
yield
to something else which is accepted as a variable by the ast parser. But it sould be better to handle it in the code to improved robutness. I've tried to find a solution but I'm unsure at which level it should be. Either in asteval (which explicitely rejectsyield
, or in bw2parameters, or in bw2io?