-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SDF CSV importer breaks when keys are missing #1293
Comments
@marc-vdm I got the same issue (AB 2.10.1) but without missing values for
As said above, my SDF does not miss any value for the from activity name,from reference product,from location,from categories,from database,from key,to activity name,to reference product,to location,to categories,to database,to key,flow type,remind - SSP2-PkBudg1150 - 2035,remind - SSP2-PkBudg1150 - 2045 |
Could it be that the way the string representation of the tuples fail to be interpreted? |
Hi, I have the same issue as Romain, as I cannot load a scenario database, getting the same syntax error. Has anyone managed to solve the issue yet? |
Hi everyone, I'm encountering the same issue related to this topic, and i would add my experience: Output from miniconda prompt -> When the SDF file is loaded into AB, it generates the error in question due to these missing flow keys. Currently, we’re manually deleting the problematic flows from the SDF file, but the results aren’t satisfactory. Does anyone have suggestions on how to resolve this issue? Thank you in advance for your help. |
@B3n0x how did you generate the SDF: using the ScenarioLInk plugin or premise? |
Both exist in ecoinvent 3.10 consequential. Can you check that they also exist in the superstructure DB to which the SDF was meant to point? |
Hi @romainsacchi, thank you for your reply. We reviewed the superstructure database by extracting it into an Excel file. The flows in question are included in the superstructure DB with the following key codes:
We attempted to manually add the missing "to key" values in the SDF file using the reported key codes. While the SDF file is successfully loaded into AB, it still does not correctly recognize these flows. To provide a clear overview, the steps we followed in AB are as follows:
Additionally, I would like to note that when we created in AB individual databases for each specific year (DB-2025 and DB-2050) separately, no errors occurred. I hope my explanation was as clear as possible. Apologies for the lengthy description, and thank you in advance for your help |
Updating AB
What happened?
When loading a CSV, the
'from key'
andto key
columns are read as literal_eval because they should contain atuple
with the key. However, when no keys are given, the cell is interpreted as empty string. This breaksast.literal_eval()
with aSyntaxError
as it only supports valid python expressions.Problem code:
activity-browser/activity_browser/bwutils/superstructure/file_imports.py
Lines 170 to 171 in dd71811
The Excel reader reads the file and afterwards properly deals with the
literal_eval
, we should do something similar for the CSV reader:activity-browser/activity_browser/bwutils/superstructure/excel.py
Lines 84 to 86 in dd71811
activity-browser/activity_browser/bwutils/superstructure/excel.py
Lines 18 to 22 in dd71811
However, not that when I just remove the converter and add the 'excel implementation', I get ~75% of my flows back unlinked, this doesn't make sense, as the CSV with missing keys saved as excel loads normally. This requires some more investigation.
Relevant errors
Operating system
Windows 11
Conda environment
No response
The text was updated successfully, but these errors were encountered: