Testing: Rotation support for MOM_read_data#1488
Conversation
This patch adds an interface and several implementations of `MOM_read_data` and `MOM_read_vector` functions which support rotational testing. The `MOM_domain_type` now carries a scalar, `turns`, indicating the number of quarter-turns from the input grid to the model grid, and a pointer to the original unrotated `MOM_domain`. If this number is nonzero, then the input field is read into an array based on the input grid, and then rotated to a new array based on the model grid. This final result is returned by the function. If the domain's `turns` is zero, then it is assumed to be a call from a non-rotated domain and no rotation is applied. Functions outside of MOM (such as calls within drivers) do not apply this rotation. For the "domain-less" reads of 2d arrays, an explicit `turns` argument is supported. This only appears to be necessary in one part of grid initialization. This is now the third place where `turns` is tracked: the first is HI (horizontal index tracking) of the MOM grid, the second in `restart_CS`, and now in `MOM_Domain`. However, I believe this is a reasonable (if not necessary) place to track the domains while also avoiding a need for users to explicitly rotate fields every time `read_data` is called.
|
The previous version of this did not include the pointer to the unrotated domain, so was incorrectly trying to use the rotated domain on unrotated inputs. |
Codecov Report
@@ Coverage Diff @@
## dev/gfdl #1488 +/- ##
============================================
- Coverage 29.03% 29.01% -0.03%
============================================
Files 236 236
Lines 71407 71506 +99
============================================
+ Hits 20736 20750 +14
- Misses 50671 50756 +85
Continue to review full report at Codecov.
|
|
The PGI compiler does not appear to be able to differentiate between the various new interfaces, which is a problem that would have to be resolved before we could merge this PR into dev/gfdl. |
|
The dual definitions of Even though we locally redefine the interface to I guess something will need to be renamed. I'd suggest renaming the |
This patch removes the `read_data_infra` alias in `MOM_io` to the infra's identically named `MOM_read_data`, and instead renames the infra function to `read_field`. This is primarily done to avert the inability of the PGI compiler to resolve the alias in the namespace. It also provides a slightly more consistent namespace: 1. It resembles the `write_field` functions in the infra layer. 2. It avoids reuse of the `read_data` name, used in FMS. 3. It allows the MOM framework layer to preserve its `MOM_` suffix, as expected for a layer intended for use within MOM. 4. `read_field` sheds any explicit reference to `MOM_`, helping to identify the infra layer as a generic interface to its framework.
|
As discussed outside the issue, I have renamed the instances of |
|
This updated PR has passed TC testing and pipeline testing with Pipeline #13545, and I agree with the updated code after visual inspection. |
This patch adds an interface and several implementations of
MOM_read_dataandMOM_read_vectorfunctions which support rotationaltesting.
The
MOM_domain_typenow carries a scalar,turns, indicating thenumber of quarter-turns from the input grid to the model grid, and a
pointer to the original unrotated
MOM_domain. If this number isnonzero, then the input field is read into an array based on the input
grid, and then rotated to a new array based on the model grid. This
final result is returned by the function.
If the domain's
turnsis zero, then it is assumed to be a call from anon-rotated domain and no rotation is applied. Functions outside of MOM
(such as calls within drivers) do not apply this rotation.
For the "domain-less" reads of 2d arrays, an explicit
turnsargumentis supported. This only appears to be necessary in one part of grid
initialization.
This is now the third place where
turnsis tracked: the first is HI(horizontal index tracking) of the MOM grid, the second in
restart_CS,and now in
MOM_Domain. However, I believe this is a reasonable (ifnot necessary) place to track the domains while also avoiding a need for
users to explicitly rotate fields every time
read_datais called.