fix correction for no_leap calendar in tests#4723
Conversation
ekluzek
left a comment
There was a problem hiding this comment.
I ran aux_clm for CTSM in ctsm5.3.016 and it's all good. And the tests that failed compare exactly to ctsm5.3.015 as I would expect.
So this fixes this from my perspective. I can create a simple PR to bring this update in.
I do suggest adding some comments around what this section is doing so it's more obvious to future developers. And this really should have some unit testing added for it to test edge cases and longer scenarios. So I'm putting this as requesting changes for those two things, comments and some unittests.
| rmon = restdatetime.month | ||
| while ryr > syr: | ||
| if rmon > 2 and calendar.isleap(ryr): | ||
| while ryr > syr and (ryr < restdatetime.year or rmon > 2): |
There was a problem hiding this comment.
I think this makes sense here. It's pretty dense and hard to understand though, so I suggest adding some comments here about what it's doing here.
There was a problem hiding this comment.
And actually because this is a bit dense, adding some unit testing around this would be good to do. And I wonder about edge cases for this as well especially dates around 2/28, that would be worth checking that it works correctly for that case.
There was a problem hiding this comment.
Since this has to loop over every year from startdate to restdate I also wonder about how this would do for an especially long period of many years. Practically most likely we aren't going to do restart tests for especially long periods, but for T compsets for example multi-decade restart tests could make sense.
There was a problem hiding this comment.
I agree that unit tests would be ideal here - covering a few specific cases - if they aren't too hard to put in place. If they are hard to put in place for some reason, then having some comments explaining this logic feels like an acceptable alternative (actually, whether or not there are unit tests).
|
It turned out not to be too hard to add unit tests. Please feel free to try more cases. |
ekluzek
left a comment
There was a problem hiding this comment.
The new commit is great and addresses my concerns. Thanks for the addition.
|
Yes, thank you very much @jedwards4b ! |
Test suite:ERP_P64x2_Ld765.f10_f10_mg37.I2000Clm60BgcCrop.derecho_intel.clm-monthly and ERP_P64x2_Ld3285.f10_f10_mg37.I2000Clm60BgcCrop.derecho_intel.clm-monthly
Test baseline:
Test namelist changes:
Test status: bit for bit
Fixes #4722
User interface changes?:
Update gh-pages html (Y/N)?: