-
Notifications
You must be signed in to change notification settings - Fork 134
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
driver: icedrv_restart: Added option for restart files to be read/written in NetCDF format #427
driver: icedrv_restart: Added option for restart files to be read/written in NetCDF format #427
Conversation
The start time for netCDF output was hardcoded to be at 00:00:00 and there was a bug in icedrv_calendar such that idate0 was fixed at Jan. 1. Both bugs are fixed. NOTE: if dt and istep0 are set such that the start time contains fractional seconds, they will be rounded down in the NetCDF output to the nearest integer.
Start of netCDF time axis is fixed at Jan. 01 00:00:00 of init_year and time value calculation is now fixed.
No functionality implemented yet, just checking it's added correctly.
…date final_restart at some point
…ad as NetCDF Added the option for restart (aka initial condition) files to be in NetCDF instead of binary for ease of setting custom inital conditions
…tart files are now identical
This looks interesting. Several comments.
Good to see CPP for USE_NETCDF and appropriate aborts. |
Thanks @apcraig! Comments in line below.
Ah gotcha. Would you mind pointing me to a spot in the code where a warning is added like that? I.e., where we just provide a warning not an abort. Alternatively I'm open to this error causing an abort since the user did ask for a restart file that wasn't written (even if the code itself otherwise ran correctly).
I agree that it would be good to include bgc. I'm not sure that I can justify spending time on it to my PI because we don't need bgc for the project that's funding me but perhaps if it's quick to do.
Correct. This is from the branch in pull request #426. I figured I would send this pull request now so we can start talking about what needs to be fixed in it. Then once #426 is merged into the consortium main I'll merge it into this branch (before taking car
Your concern makes sense. I'll take a look at how to do this efficiently.
I agree that it would be nice if they were the same. CICE uses restart_format and history_format so I would vote for changing history_cdf to history_format.
That sounds good to me. Do we already have tests that validate history output? Or would that test just verify that icepack completes a run with history output indicated?
|
I would also vote for using the same namelist flags and options/values for history and restart as in CICE. Less confusing. |
If you look in icedrv_init.F90, you'll see various examples of writing and/or aborting directly.
Depending where you are in the code and what the error is, you may want to write to either nu_diag or nu_diag+n-1. The latter is to write to each column's output file. The former is the general output file. Lets change the namelist to history_format and restart_format, are you able to do that? We do not have tests that formally validate history output. We just check the model completes fine. Thanks. |
Thank you for the examples. I've fixed the warnings, merged in the updated consortium: main, changed history_cdf to history_format, and updated the documentation. I'm about halfway through reorganizing icedrv_restart as you suggested. I should be able to finish that sometime tomorrow. Do you want me to move the new test suite into io_suite.ts and add in the mixed history/restart format options? |
The compile is failing here. The variable nchar needs to be declared in the subroutine restartfile. |
Actually, it's in several other subroutines. It should probably be a module variable. |
With regard to testing, this is what I'd do. set_env.ionetcdf can stay as is. Rename set_nml.ionetcdf to set_nml.histcdf and it would be just "history_format = 'nc'". Then add set_nml.restcdf which would be just "restart_format = 'nc'". The I would remove netcdf_nobgc_suite.ts and then add the following to io_suite.ts,
I think this is adequate but if you also want to add a couple other cases to test exact restart of other physics (like netcdf_nobgc_suite.ts does), that's fine too. In general, we can't test every option with each other as we'd end up with millions of tests. So in this case, we're testing the default physics with various combinations of binary and netcdf history and restart to cover this feature. By the way, noticed in the current PR, you still need to add restart_format to ug_case_settings.rst and icepack_index.rst. Didn't do a thorough review yet, just noticed that so I'll mention it. Thanks! |
Sounds good. I have finished reorganizing the code, changing the namelists and tests, etc. This most recent version passes all tests in base_suite, io_suite, the nobgc netcdf restart suite (which I've now removed), and the CICE quick_suite. I think that I've updated the documentation in the correct places, but let me know if I've missed anything there. I'll be out of the office for the next two weeks so if any further fixes are needed I'll get to them after then. Thanks! |
The automated testing is failing with this error: Which is confusing to me because set_nml.restcdf is present (and worked in my ubuntu container). |
I think the CI is failing because you may need a return character at the end of the io_suite.ts file. It looks like the CI env is adding a # there for reasons I don't understand. But I suspect returning to a new line will fix that. The other thing I suggest is setting the default value of history_format to "none". Also, please add checks in icedrv_init.F90 to check for valid values for history_format and restart_format. Those valid values should be "['none','cdf'] and ['bin','cdf'] at this point I believe. Finally, the documentation of these two namelist variables in doc/source/user_guide/ug_case_settings.rst should follow the style for namelist with limited options,
I will run some tests now just to check things are working as expected too. Thanks! |
- icedrv_init write format for history_format - dims allocation in icedrv_restart - cleaned up some intent lines (old) - add return at end of io_suite.ts - update namelist documentation of history_format, restart_format Update to current main trunk
I created a PR, davidclemenssewall#1, based on testing on cheyenne. |
Check history_format and restart_format input values
@davidclemenssewall, have you had a chance to review my proposed changes? It would be good to get this PR merged. Thanks. |
Fix minor issues found during testing
@apcraig sorry for my delay. I'm still digging out from stuff that built up during the mosaic conference and the polar climate working group. All of the changes look good and thank you for fixing my errors (I just started learning fortran recently). I also checked that the base_suite and io_suite passed all tests on Ubuntu. |
@davidclemenssewall, no problem. just trying to keep things moving along. I will run a final test myself then will merge. Thanks for all your efforts, great to have new people contributing. |
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 the Icepack test suite on cheyenne and all passes as expected. I will merge tomorrow unless someone squeaks.
For detailed information about submitting Pull Requests (PRs) to the CICE-Consortium,
please refer to: https://github.com/CICE-Consortium/About-Us/wiki/Resource-Index#information-for-developers
PR checklist
Added option for restart files to be read/written in NetCDF format (except for BGC tracers).
David Clemens-Sewall (building off code written by Chris Riedel)
I've added the test suite 'netcdf_nobgc_suite' to check that switching the restart files to NetCDF doesn't change any output. This suite contains all of the restart tests from Icepack's base_suite (except for the bgc tracers) with the setting 'ionetcdf' activated. The modified code passes all 64 tests. Also, Icepack base_suite and CICE quick suite both pass with 128/128 and 16/16 respectively.
This PR doesn't implement NetCDF restart files for BGC tracers (which is outside the current scope of my project). It does add an additional namelist variable 'restart_format' to indicate whether the restart files should be read/written in binary format ('bin') or NetCDF ('nc'). The default is 'bin'. However, if the "ionetcdf" setting is set then I chose to have the restart_format namelist variable set to 'nc'. Which seemed consistent with the idea that if the user sets "ionetcdf" they probably want all of the input and output to be netCDF.