Skip to content
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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

apcraig
Copy link
Contributor

@apcraig apcraig commented Jan 31, 2025

PR checklist

  • Short (1 sentence) summary of your PR:
    Add ability to write out one-time grid history file
  • Developer(s):
    apcraig
  • Suggest PR reviewers from list in the column to the right.
  • Please copy the PR test results link or provide a summary of testing completed below.
    Tests pass as expected, https://github.com/CICE-Consortium/Test-Results/wiki/cice_by_hash_forks#792aac351375090653303efe6280f8f8fc141db8
  • How much do the PR code changes differ from the unmodified code?
    • bit for bit
    • different at roundoff level
    • more substantial
  • Does this PR create or have dependencies on Icepack or any other models?
    • Yes
    • No
  • Does this PR update the Icepack submodule? If so, the Icepack submodule must point to a hash on Icepack's main branch.
    • Yes
    • No
  • Does this PR add any new test cases?
    • Yes
    • No
  • Is the documentation being updated? ("Documentation" includes information on the wiki or in the .rst files from doc/source/, which are used to create the online technical docs at https://readthedocs.org/projects/cice-consortium-cice/. A test build of the technical docs will be performed as part of the PR testing.)
    • Yes
    • No, does the documentation need to be updated at a later time?
      • Yes
      • No
  • Please document the changes in detail, including why the changes are made. This will become part of the PR commit log.

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

…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.
Copy link
Contributor

@eclare108213 eclare108213 left a 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?

@apcraig
Copy link
Contributor Author

apcraig commented Jan 31, 2025

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.

@apcraig
Copy link
Contributor Author

apcraig commented Jan 31, 2025

Does anyone have a comment about the namelist name "grid_outfile". Would "grid_histout" or "hist_gridout" or something else be better?

@dabail10
Copy link
Contributor

Sorry I haven't had a chance to look at this. I will try next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write grid variables only once.
3 participants