brightway-lca / brightway2-data

Tools for the management of inventory databases and impact assessment methods. Part of the Brightway LCA framework.
https://docs.brightway.dev/
BSD 3-Clause "New" or "Revised" License
8 stars 23 forks source link

fix iterator over exchanges #163

Closed mfastudillo closed 6 months ago

mfastudillo commented 6 months ago

otherwise it gives an error when trying to loop over the exchanges e.g. list(act.exchanges()). I can create a test if needed.

BenPortner commented 6 months ago

Hi @mfastudillo, thank you very much for your contribution! A test in addition to the code change would be formidable :)

BenPortner commented 6 months ago

@mfastudillo Unless I made a mistake, I believe this test also works before the fix. Could you implement a test that fails pre-fix and succeeds post-fix?

Edit: I implemented a test and will push it.

mfastudillo commented 6 months ago

Thanks @BenPortner , indeed the test I created was working also without the change. I am not entirely sure what was causing the resource not to have the matrix. I thought maybe defining the "extra biosphere db" (mouse) and forgetting to set the type as emission but I tried this morning and it didn't seem to be the problem

BenPortner commented 6 months ago

@mfastudillo I was wondering the same thing. Calling the write_exchanges method without any biosphere exchanges reproduces the error but this shouldn't happen with a real IOTable. Perhaps this hints at another error?