-
Notifications
You must be signed in to change notification settings - Fork 136
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
Add ability to write out one-time grid history file #1005
base: main
Are you sure you want to change the base?
Conversation
…tures - Add grid_outfile logical namelist - Add extra history stream to be used just for grid output file, that stream is designated with the histfreq='g' label. It's turned on with the logical grid_outfile namelist and then automatically turned off after it's written the first time. This happens in ice_history.F90. - Add logic in ice_history_write.F90 to explicitly write the grid fields to the grid history file. - The one time grid filename is iceh_grid.nc - Add grid_outfile=.true. to set_nml.histall Fix bug in PIO where 5d variables had their two "z" axis coordinates reversed when writing the field even though the variable had the correct axes defined in the history file. Detected by comparing netCDF and PIO history files. Set history netcdf attribute Conventions to CF-1.8. Ran history files through a CF checker. This resulted in several warning messages but no errors. Warning could be fixed later if needed. Add axis to the history coord_attributes datatype to provide another attribute on the netcdf file. Set axis to 'X', 'Y', or 'T' to a small subset of history file coordinate variables. Change netcdf "unitless" unit to "1". Update some abort calls in ice_history.F90 Update version_name namelist implementation, was not being broadcast or written to the log file. Affected history file output. Remove hist namelist settings in set_nml.run* files to minimize conflicts with other namelist options groups. Add a test case that allows manual comparison of netCDF and PIO history files. This needs to be done with cprnc. cmp of restart files and diff of log files produce differences even when results are bit-for-bit identical.
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.
Nicely done. My question is whether fixing the PIO axis bug will mess up anyone's post-processing tools. Or have they not been plotting what they thought they were plotting?
It's hard to know how many users are looking at 5d output fields. And this bug was only with PIO output which would probably impact only CESM users and a few other groups. Hard to know how they were interpreting the output, but it was something that had to be fixed. This fix probably has the smallest impact relative to other ways it could have been fixed. We can try to highlight this bug in our Release Notes. |
Does anyone have a comment about the namelist name "grid_outfile". Would "grid_histout" or "hist_gridout" or something else be better? |
Sorry I haven't had a chance to look at this. I will try next week. |
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 @apcraig !
grid_file
could be renamed to grid_file_in
and then the output could be grid_file_out
?
My preferences for this change would be:
- grid output file name is configurable. It could be that
grid_file_out
is none for no output instead of.false.
and otherwise the filename. - no time dimension / variable in the grid output. Having a time variable in data that doesn't change is confusing for post processing tools. The model time can still be in the attributes.
- raise an error if the user tries to use
grid_outfile = .true.
with binary io ?
Some other cf related stuff that might help:
- adding all the grid variables to the
external_variables
global attribute would clean a bunch or warnings in the history output when it's in a different file. see https://cfconventions.org/cf-conventions/cf-conventions.html#external-variables - it looks like we could add the
standard_name
attribute to our output variables too - its unrelated to this change though. And thatdate_created
as a global attribute would be more conventional thanhistory
- it also looks like CF prefers for the time bounds variable not to have 'long_name','units' or 'calendar' attributes. they are inherited from the 'time' variable. See http://cfconventions.org/Data/cf-conventions/cf-conventions-1.7/cf-conventions.html#cell-boundaries
Thanks @anton-seaice, lots of good ideas. I'm not sure we should have a string for grid_file_out. That's not how the history mechanism works in general. The namelists hist_file and hist_suffix with the frequency generates the history filename. The grid history file does the same. I will remove the time axis from the grid history file, that's a good idea. I considered a number of other updates to the history files for CF including removing the bounds attributes. I will also look into the external_variables attribute. I'm not familiar with that one. Should that only be set if the grid variables are NOT in the file? Agree standard_name would be useful. I'm a little afraid that I'll add names that are not standard though :). I was inclined to leave the history files the same as much as possible, as long as CF errors weren't there. But I'm happy to do some more work to clean up the CF warning messages and to add other attributes if that makes sense to others. I worry a little about backwards compatibility (ie. if someone is looking for a certain attribute that we remove or rename), but maybe we should just move forward. Thoughts? |
PR checklist
Add ability to write out one-time grid history file
apcraig
Tests pass as expected, https://github.com/CICE-Consortium/Test-Results/wiki/cice_by_hash_forks#792aac351375090653303efe6280f8f8fc141db8
Add ability to write one-time grid file in netCDf and PIO history features
- Add grid_outfile logical namelist
- Add extra history stream to be used just for grid output file, that stream is designated with the histfreq='g' label. It's turned on with the logical grid_outfile namelist and then automatically turned off after it's written the first time. This happens in ice_history.F90.
- Add logic in ice_history_write.F90 to explicitly write the grid fields to the grid history file.
- The one time grid filename is iceh_grid.nc
- Add grid_outfile=.true. to set_nml.histall
Fix bug in PIO where 5d variables had their two "z" axis coordinates reversed when writing the field even though the variable had the correct axes defined in the history file. Detected by comparing netCDF and PIO history files.
Set history netcdf attribute Conventions to CF-1.8. Ran history files through a CF checker. This resulted in several warning messages but no errors. Warning could be fixed later if needed.
Add axis to the history coord_attributes datatype to provide another attribute on the netcdf file. Set axis to 'X', 'Y', or 'T' to a small subset of history file coordinate variables.
Change netcdf "unitless" unit to "1".
Update some abort calls in ice_history.F90
Update version_name namelist implementation, was not being broadcast or written to the log file. Affected history file output.
Remove hist namelist settings in set_nml.run* files to minimize conflicts with other namelist options groups.
Add a test case that allows manual comparison of netCDF and PIO history files. This needs to be done with cprnc. cmp of restart files and diff of log files produce differences even when results are bit-for-bit identical.
Update documentation
Closes #613