-
Notifications
You must be signed in to change notification settings - Fork 27
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
Check CICE4 restart file dates #539
Check CICE4 restart file dates #539
Conversation
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.
Thanks @blimlim - if its feasible to check the value of dumpfreq
in the cice namelist that would be great.
I think whatever we do will be unavoidably messy, i made some suggestions, not sure if they are useful or not!
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 ran this and checked it makes the expected error, ill finish the review tomorrow :)
I was thinking about this yesterday - it leaves the config in a kind of weird state. e.g. The model runs & completes (the archive step succeeds) however there is no restart saved to restart the model. The user only gets an error once they try to restart and is it clear they need to go back one model run to fix this ? I don't think payu has an easy way of going back one run ? ( I guess deleting the output & restart folder is the way to do that?) Obviously once the check on the dump dates is done at the start of the run, then the issue goes away. I guess we could move the check in this PR to the end of a run, e.g. the archive step fails if the cice restart file is at the "wrong" time?. For a release, we can put this in the known issues and provide advice on the workaround as needed. |
That's a good point! Setup stage:
Archive stage:
And once we add the |
I am ok with all the checks being there :-). If you have time, then go ahead, if you don't and want to get a release out - then what we have prevents already in this PR prevents the initial error, its just messy to recover from . |
Sweet, I've added an additional check during the archive stage in access.py here I've incorporated a test of this into the existing There's also an additional test, checking that an error is raised when the correct iced file is not present. |
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 did adhoc tests for :
- Trying to restart with a cice restart with the wrong date - payu raised error
- Two consecutive months with correct restarts - ran ok
Thanks @blimlim this is neat piece of work :) |
Awesome, thanks @anton-seaice for your help with this :) I'll go make that issue about the additional tests I've just made one more tiny commit fixing a typo, and undoing an unnecessary change I'd made earlier. @aidanheerdegen if you have any time to look over this, that would be much appreciated, apologies for cutting it so close time wise with this! |
Note: I've started this pull request as a draft as it currently has no unit tests. However, I had quite a bit of trouble working out the best way to structure these changes (which drivers to put them in etc), and hence would appreciate any comments/feedback/ideas/suggestions on the structure while I'm working on the unit tests.
This draft PR addresses #538, introducing two guards against CICE4 using a restart file whose date clashes with the date in the restart calendar file. This should prevent:
iced.YYYYMMDD
restart file.These are both handled by the
cice4_make_restart_pointer()
function. This checks that aniced.YYYYMMDD
file exists with a name matching the start date calculated from the calendar restart file (restart_date.nml
). It then checks that thetime
in theiced
file's header matches the previous runtime calculated from the calendar restart file, before writing the new pointer file.This function is called during the
setup
stage of theaccess
driver.I think it would have made sense to place these steps in the
cice
driver, and include necessary overrides in thecice5
driver, rather than putting them in theaccess
driver as I've done here. The challenge was that for CICE4 in ESM1.5, theaccess
driver calculates the start date and run time used by the model, and hence it contains the data needed to correctly identify theiced.YYYYMMDD
file and check its header.Meanwhile the start date and prior runtime calculated in the
cice
driver (based on thecice_in.nml
files) appear to be mostly (but not completely) unused by the model, are incorrect (i.e. in the PI configuration'scice.py
calendar has always been 100 years off the actual date used by the model), and use the wrong type of calendar. Because of this, I thought it was simplest to implement the changes in theaccess
driver where the available information is correct.I've included a blank
make_restart_ptr()
method in thecice
driver, and overridden it in thecice5
driver so that CICE5 is unaffected by these changes.I'll get started on some testing, but it would be great to hear if you have any feedback on this overall structure. It's clearly not the cleanest or most intuitive, and so any ideas would be welcome.