-
Notifications
You must be signed in to change notification settings - Fork 26
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
Replace CICE start date calculations #484
Replace CICE start date calculations #484
Conversation
Hello @blimlim! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2024-08-21 06:30:16 UTC |
Oh my bad. I'll fix these PEP issues and ping everyone when done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just added comments with background on a couple of the choices I made.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd really really really recommend adding some model driver tests, even just a minimal set that covers the expected behaviour of this code.
There are some examples you can base tests on here
https://github.com/payu-org/payu/blob/master/test/models/
I'd guess the one @jo-basevi wrote would be a good start
https://github.com/payu-org/payu/blob/master/test/models/test_mom_mixin.py
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
input_ice has lots of fields unrelated to restarts in it, so i'm not sure why we are adding another file? Whats the purpose in keeping the timing information on the completed run seperately?
I assume we are changing how runtime0 is calculated
from
runtime0= res_runtime0 + res_runtime
to
runtime0 = res_inidate - res_init_date (in seconds)
so that the user can change res_inidate
if they desire (this is the date the current run starts at)?.
For some reason I thought it would be good to read the init_date from the new restart file (I forget why...), though this could be moved back to reading it from the control directory if everyone thinks it is cleaner.
This is something to do with the warm-start script ... if the config comes from one location and the restart comes from a different location, I don't know which one is sensible to get the restart date in? I guess it depends on the warm start script and also which location its set in other models ?? I'm not really sure why this isn't the only change needed actually ?
Previously payu had been copying the whole Related to this – with the changes, the
Unfortunately the restart date is also held by the binary
I think it would work for the only change to be for the |
Good idea. I've had a go at adding some tests, first of the individual calendar functions used in the calculations, and then a bigger test of the actual driver: The driver test cycles over the |
Test for month/day increments Co-authored-by: Anton Steketee <[email protected]>
Merge branch 'master' into 466-esm1p5-cice-startdate-fix
I ran this and it works with the dates look correct for the first couple of months of picontrol. I didn't test trying to change the start date or what happens with a leap year. |
The tests run and pass as-is, so if you want to defer the suggested changes to the tests to after release, that would be ok |
Thanks for the reviews! Lots of good ideas which help make the changes clearer and also improve the tests. I've added in the different suggestions, and also added an additional test of the The previous test which cycled over the |
This looks good @blimlim - I just had some tidyups on the testing in the suggestions :) |
Typo Co-authored-by: Anton Steketee <[email protected]>
Typo Co-authored-by: Anton Steketee <[email protected]>
Comment clarity and additional test cases Co-authored-by: Anton Steketee <[email protected]>
Awesome thanks for those suggestions – very helpful for making the code clearer and improving the tests! I've added those in and let me know if there are any other suggestions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work Spencer !
@aidanheerdegen are you happy for this one to be merged, or did you have any other suggestions? |
This PR covers the first part of #466. It tries to simplify the setting of CICE's start date in ACCESS-ESM1.5 simulations, in order to avoid inconsistency bugs and to make the restart timing more transparent to the user.
The previous calculations for setting the cice start date used:
and
in order to set the start date of a new simulation, payu would calculate a start date as
inidate = control_init_date + res_runtime0 + res_runtime
(with required unit conversions).It would then populate the work directory copy of
input_ice.nml
with values for the model to use for the new simulation:This PR replaces
restart_dir/ice/input_ice.nml
with a new filerestart_dir/ice/restart_date.nml
containing:During setup, payu then fills the work directory copy of
input_ice.nml
with:My goal here was to ensure that cice receives the exact same values of
init_date
,inidate
,runtime
,runtime0
with the new calculations that it would have received with the old calculations, which is why the updates use theinit_date
and calculate the number of seconds between it and theinidate
. It would be simpler to just set bothinit_date
andinidate
to the new start date, and setruntime0=0
, however this would give different information tocice
.For some reason I thought it would be good to read the
init_date
from the new restart file (I forget why...), though this could be moved back to reading it from the control directory if everyone thinks it is cleaner.Backwards compatibility will be broken with this PR, and if merged, we will have to add
restart_date.nml
files to thevk83
restart directories.Future work would making a separate function for reading the start date, which could then be used for consistency checks between the different component's start dates, though I'll defer that to a future PR/issue.
For the review, any suggestions on structure, clarity, and also correctness of the calculations would be very welcome!