XIOS: Separate out testing of restarts and diagnostics#1010
Merged
joewallwork merged 7 commits intodevelopfrom Jan 21, 2026
Merged
XIOS: Separate out testing of restarts and diagnostics#1010joewallwork merged 7 commits intodevelopfrom
joewallwork merged 7 commits intodevelopfrom
Conversation
This was referenced Jan 8, 2026
joewallwork
commented
Jan 13, 2026
Comment on lines
+199
to
+213
| #ifdef USE_XIOS | ||
| // Account for the fact that XIOS writes dimensions differently if only one | ||
| // discretisation is written out. If the dimension is still null at this point then we | ||
| // assume that the only discretisation used is HDomain-based, i.e., HField, DGField, or | ||
| // DGSField. | ||
| if (dim.isNull()) { | ||
| if (dimensionSpec.name == "x_dim") { | ||
| dim = ncFile.getDim("x"); | ||
| } else if (dimensionSpec.name == "y_dim") { | ||
| dim = ncFile.getDim("y"); | ||
| } else { | ||
| continue; | ||
| } | ||
| } | ||
| #endif |
Contributor
Author
There was a problem hiding this comment.
This is fixed by #1015, which ensures that XIOS never writes out files with x or y as dimensions.
joewallwork
added a commit
that referenced
this pull request
Jan 13, 2026
joewallwork
commented
Jan 13, 2026
Comment on lines
+965
to
+971
| { "yx", ModelArray::Type::H }, | ||
| { "ydimxdim", ModelArray::Type::H }, | ||
| { "y_dimx_dim", ModelArray::Type::H }, | ||
| { "yxdg_comp", ModelArray::Type::DG }, | ||
| { "ydimxdimdg_comp", ModelArray::Type::DG }, | ||
| { "y_dimx_dimdg_comp", ModelArray::Type::DG }, | ||
| { "yxdgstress_comp", ModelArray::Type::DGSTRESS }, |
Contributor
Author
There was a problem hiding this comment.
These changes will also be reverted in #1015.
timspainNERSC
approved these changes
Jan 21, 2026
Collaborator
timspainNERSC
left a comment
There was a problem hiding this comment.
As usual with the XIOS tests, I haven't done more than a check that the they look reasonable and logical. Everything else looks good.
Contributor
Author
Thanks @timspainNERSC. I'm going to wait for the current CI jobs on |
joewallwork
added a commit
that referenced
this pull request
Jan 21, 2026
Merges into #1010. Currently in #1010 we have the following issue with writing fields with XIOS: * If there are multiple fields that are (between them) based on two or more XIOS domains then the dimension names get appended with those domain names. By naming the domains `dim`, `vertex`, and `cg`, this gives rise to dimensions `x_dim`, `y_dim`, `x_vertex`, `y_vertex`, `x_cg`, and `y_cg`. * If the fields being written out are only based on one XIOS domain then the appendment doesn't happen, meaning we just have `x` and `y`. The workaround in that PR handles dimensions `x` or `y` in a file being read by assuming they correspond to `x_dim` and `y_dim`. Ideally, we would avoid having `x` or `y` alone in any files and instead make a post-processing of the output file after it is written with XIOS. That's achieved in this PR via a post-processing step. Upon finalising the XIOS context, we: 1. Count how many different XIOS domains were used for writing out. If there was exactly one then we proceed to tackle the issue. 2. Loop overall output files that might have been written by XIOS and check they exist. 3. For any such files that exist, rename the dimensions and variables as appropriate and write out. To achieve this, I had to implement subtraction of a `Duration` from a `TimePoint` because of how XIOS presents the time window suffices.
joewallwork
added a commit
that referenced
this pull request
Feb 4, 2026
# XIOS: properly handle filename patterns Fixes #935 Fixes #997 Fixes #898 Fixes #933 Makes #967 redundant Refinement of #1002 ~~Merges into #1010~~ Merges into #1015 ### Task List - [x] Defined the tests that specify a complete and functioning change (*It may help to create a [design specification & test specification](../../../wiki/Specification-Template)*) - [x] Implemented the source code change that satisfies the tests - [x] Documented the feature by providing worked example - [x] Completed the pre-Request checklist below --- # Change Description This PR fixes several things related to how restarts and diagnostics are configured with XIOS: 1. Properly handle file patterns in filenames. 2. Restart file output frequency and split frequency are aligned so that each output file dump only includes a single timestep's worth of data. 3. Restart files are only read once. 4. Ensure XIOS writes the first timestep. Whilst file patterns are made consistent with what's used elsewhere in nextSIM-DG, the output filenames show the range of datetimes separated by a hyphen. --- # Test Description Tests are updated to account for the new behaviour. I decided to drop `XiosFile_test` because it is no longer needed. This meant that we could drop the annoying `unittest` special case. This is what gives the large number of lines removed. --- # Documentation Impact The XIOS documentation page has been updated accordingly. --- ### Pre-Request Checklist - [x] The requirements of this pull request are fully captured in an issue or design specification and are linked and summarised in the description of this PR - [x] No new warnings are generated - [x] The documentation has been updated (or an issue has been created to track the corresponding change) - [x] Methods and Tests are commented such that they can be understood without having to obtain additional context - [x] This PR/Issue is labelled as a bug/feature/enhancement/breaking change - [x] This change conforms to the conventions described in the README
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
XIOS: Separate out testing of restarts and diagnostics
Fixes #977
Fixes #1003
Refinement of #1002
Task List
Test Description
This PR separates the XIOS reading and writing tests out by type. In addition, we add a read test for the diagnostic outputs and check that they are time-averaged.
Change Description
Code changes are made to account for the case where only one XIOS domain is used when writing. This is required due to an unfortunate consequence of the way XIOS appends the domain name only if there are two or more domains.
In detail: if only one domain type is used then the output file will use
xandydimensions, rather than the versions appended with_<dimName>. We account for this by assuming thatxandyimplyx_dimandy_dimif encountered in an input file.Documentation Impact
n/a
Pre-Request Checklist