iiasa / climate-assessment

https://climate-assessment.readthedocs.io/en/latest
MIT License
19 stars 18 forks source link

Fix if all emissions data starts in 2015, in :func:`add_year_historical_percentage_offset` #49

Closed jkikstra closed 9 months ago

jkikstra commented 9 months ago

Previously, if an input emissions data set had only 2015 emissions data and onwards, an error would be raised. This is because 2010 would not be in the "filtered emissions data set" where there is no 2015, but the issue is that this "filtered emissions data set" is actually empty, so there's no need to raise an error.

jkikstra commented 9 months ago

@phackstock should be solved now. @znicholls also fyi, I ran into this issue earlier today when playing around (surprising that we haven't encountered this before)!

Since it is so minor, I didn't add other things, but if you think it is necessary, I can add a test (e.g. additional test-data file, or deleting some years from a current test-data file) for this specific issue?

znicholls commented 9 months ago

@znicholls also fyi, I ran into this issue earlier today when playing around (surprising that we haven't encountered this before)!

Funny. I have hit it before but been too lazy to fix so have done other workarounds.

Since it is so minor, I didn't add other things, but if you think it is necessary, I can add a test (e.g. additional test-data file, or deleting some years from a current test-data file) for this specific issue?

A test would be ideal to make sure this doesn't accidentally come back. Having said that, this repo is such a mess that if it's too much to deal with I can understand that too.

jkikstra commented 9 months ago

I've added a minimal test.