-
Notifications
You must be signed in to change notification settings - Fork 157
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
Extend feature vintage_and_active_years() #572
Conversation
@khaeru I have revised the function |
Thanks for this PR, I was actually looking at this issue and almost developing something along the lines of Option 2 mentioned in Issue #571 but looking at the current code it is not so clear to me if it takes into account the above-mentioned case. So would it be possible to run it with |
@adrivinca yes, the tests if have this use-case as a test. |
Thanks! I cloned the branch and tried it, it seems ok and the tests as well. |
It seems the tests fail on mac, do you understand why? I don't really |
@adrivinca the reason for these test failing was because this was a test carried out in |
Codecov Report
@@ Coverage Diff @@
## main #572 +/- ##
=======================================
+ Coverage 92.8% 93.0% +0.1%
=======================================
Files 42 43 +1
Lines 3287 3375 +88
=======================================
+ Hits 3052 3139 +87
- Misses 235 236 +1
|
@adrivinca and @khaeru I have made one last adjustment to the PR and added a test for it. Ideally, this function will replicate the behvior of map_tec_lifetime in that the returned activity years for any given vintage wont exceed the maximum technical_lifetime defined for a technology. The documentation has also been updated as have the release notes. |
@adrivinca asked me to take a look at this. I can check more extensively perhaps tomorrow or Friday, but at a skim of the thread I'm concerned about this statement:
Please read:
To expand:
See some examples in Pandas: https://pandas.pydata.org/pandas-docs/stable/whatsnew/v1.4.0.html#deprecations Sometimes it takes a little thinking, but it is always possible to introduce new functionality in a non-breaking way; often with an added optional argument. If existing tests fail, that means we are introducing breaking changes, and we can't respond by simply removing the tests. |
@khaeru thanks for the comments. The old tests have been moved from the core to a separate file. If you look at the differences, then the |
Remove calls to Scenario.add_par("duration_period", …); since #286 these are redundant when .add_horizon() is used.
Okay, I've streamlined the tests here; about 2:45 of work. Some points plus comments inline.
I'll next start to look at the actual implementation and the documentation of the method. |
- add_horizon() - vintage_and_active_years() - years_active()
@OFR-IIASA in 292edf4 I add some tests/examples showing how the functionality of the added Kind of like Is this acceptable? If so, I'll remove the added arguments. |
- Remove vtg_lower, act_lower arsg in favour of .query(). - Deprecate in_horizon. - Add tl_only.
@OFR-IIASA aside from the persistent dtype issues on Windows, which I will fix, this is complete per our discussion. Please have a look and comment if you agree. |
d90a27d
to
4b980e9
Compare
@khaeru thanks for the formidable rework. Everything is as we agreed. |
This PR extends the features of the function
vintage_and_active_years()
based on issue #571How to review
vintage_and_active_years()
developer (someone like the reviewer) will be able to understand what the code
does in the future.
PR checklist