polca / premise

Coupling Integrated Assessment Models output with Life Cycle Assessment.
BSD 3-Clause "New" or "Revised" License
101 stars 45 forks source link

Correction in transformation.py #102

Closed mkvdhulst closed 1 year ago

mkvdhulst commented 1 year ago

I discovered an issue with premise 1.5.0-beta2 when creating a scenario for IMAGE SSP2 RCP2.6 2025. When generating scenarios for clinker production, a KeyError: 'product' occurred in transformation.py line 1061. I compared versions and noticed that in premise 1.5.0-beta2, line 1061 reads:

].append((ccs["name"], ccs["product"], ccs["location"], ccs["unit"]))

whereas in premise 1.5.0-alpha8, line 909, this was

(ccs["name"], ccs["reference product"], ccs["location"])

I manually changed line 1061 in my local copy of transformation.py from ["product"] to ["reference product"] and ran premise again and this resolved the issues.

For context: this error did not occur for certain other scenarios in my scenario dictionary. I created a dictionary with scenarios for 2020-2055 at 5 year intervals for IMAGE SSP2 baseline, RCP2.6 and RCP1.9. The clinker scenarios for IMAGE SSP2 baseline 2020-2055 at 5 year intervals and for IMAGE SSP2 RCP2.6 2020 were generated without a problem. The error came up only when moving on to the next scenario in the dictionary: IMAGE SSP2 RCP2.6 2025. So somehow, the KeyError only affects some of the scenarios. I did not test or look into why this is.

In issue #101, I mentioned I would create a pull request, but a colleague advised me that raising an issue would be more practical for such a small change. I am still figuring out how to work with GitHub, so if a different way of contributing is preferred, e.g. by creating a branch, please let me know.

romainsacchi commented 1 year ago

Hi, thanks! This will be fixed in the new release later today. Indeed, it only occurs when a scenario requires CCS on cement production, which is why non-ambitious scenarios did not raise the issue.

romainsacchi commented 1 year ago

This should now be fixed with 1.5.0-b3.