Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
be83fd9
Add diag manager test to register var with different axes permutations
abrooks1085 Feb 3, 2026
48085d9
Merge branch 'NOAA-GFDL:main' into feature/general-indices-diag-manag…
abrooks1085 Apr 16, 2026
082437b
fix line length
abrooks1085 Apr 16, 2026
542014a
Remove trailing ws
abrooks1085 Apr 16, 2026
fa77ebe
Remove trailing ws?
abrooks1085 Apr 16, 2026
35cf8d7
Merge branch 'NOAA-GFDL:main' into feature/general-indices-diag-manag…
abrooks1085 Apr 23, 2026
3b3aec8
Add generalized axis permutation tests for diag_manager
abrooks1085 Apr 24, 2026
63dcf63
Merge branch 'NOAA-GFDL:main' into feature/general-indices-diag-manag…
abrooks1085 May 14, 2026
4561894
Merge branch 'NOAA-GFDL:main' into feature/general-indices-diag-manag…
abrooks1085 Jun 4, 2026
9173b41
Test removing circular module dependency
abrooks1085 Jun 4, 2026
96070f7
remove mpp module dependence from testing_utils
abrooks1085 Jun 4, 2026
0f02818
test_fms/diag_manager/testing_utils.F90
abrooks1085 Jun 4, 2026
a478bb3
remove contiguous keyword in diag_send_data
abrooks1085 Jun 8, 2026
4757961
remove all contiguous keyword in diag_send_data
abrooks1085 Jun 8, 2026
eee2b3c
rename diag manager generalized indices unit tests
abrooks1085 Jun 8, 2026
defe20b
change test executable name
abrooks1085 Jun 9, 2026
aa3d046
Update test_fms/diag_manager/Makefile.am
abrooks1085 Jun 10, 2026
c2e7c4b
Update test_fms/diag_manager/test_time_none.sh
abrooks1085 Jun 10, 2026
cdda131
renamed: check_generalized_indices.F90 -> check_diag_generalized_i…
abrooks1085 Jun 11, 2026
57f4866
rename diag test/checker
abrooks1085 Jun 11, 2026
8bd3286
Add generalized indices checker dependency
abrooks1085 Jun 11, 2026
115ce53
Revert "Add generalized indices checker dependency"
abrooks1085 Jun 11, 2026
33a9fd4
Add generalized indices checker to CMakeLists.txt
abrooks1085 Jun 11, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -663,8 +663,10 @@ if(UNIT_TESTS)
test_fms/diag_manager/test_flush_nc_file.F90
test_fms/diag_manager/test_diag_out_yaml.F90
test_fms/diag_manager/test_reduction_methods.F90
test_fms/diag_manager/test_diag_generalized_indices.F90
test_fms/diag_manager/testing_utils.F90
test_fms/diag_manager/test_diag_diurnal.F90
test_fms/diag_manager/check_diag_generalized_indices.F90
test_fms/diag_manager/check_time_none.F90
test_fms/diag_manager/check_time_min.F90
test_fms/diag_manager/check_time_max.F90
Expand Down
6 changes: 3 additions & 3 deletions diag_manager/diag_manager.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1683,12 +1683,12 @@ END FUNCTION send_data_3d
LOGICAL FUNCTION diag_send_data(diag_field_id, field, time, is_in, js_in, ks_in, &
& mask, rmask, ie_in, je_in, ke_in, weight, err_msg)
INTEGER, INTENT(in) :: diag_field_id
CLASS(*), DIMENSION(:,:,:), INTENT(in),TARGET,CONTIGUOUS :: field
CLASS(*), DIMENSION(:,:,:), INTENT(in),TARGET :: field
CLASS(*), INTENT(in), OPTIONAL :: weight
TYPE (time_type), INTENT(in), OPTIONAL :: time
INTEGER, INTENT(in), OPTIONAL :: is_in, js_in, ks_in,ie_in,je_in, ke_in
LOGICAL, DIMENSION(:,:,:), INTENT(in), OPTIONAL, contiguous, target :: mask
CLASS(*), DIMENSION(:,:,:), INTENT(in), OPTIONAL, contiguous, target :: rmask
LOGICAL, DIMENSION(:,:,:), INTENT(in), OPTIONAL, target :: mask
CLASS(*), DIMENSION(:,:,:), INTENT(in), OPTIONAL, target :: rmask
CHARACTER(len=*), INTENT(out), OPTIONAL :: err_msg

REAL :: weight1
Expand Down
4 changes: 3 additions & 1 deletion test_fms/diag_manager/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ check_PROGRAMS = test_diag_manager test_diag_manager_time \
check_time_pow check_time_rms check_subregional test_cell_measures test_var_masks \
check_var_masks test_multiple_send_data test_diag_out_yaml test_output_every_freq \
test_dm_weights test_prepend_date test_ens_runs test_diag_multi_file test_diag_attribute_add \
check_new_file_freq test_zbounds_limits test_multiple_zbounds
check_new_file_freq test_zbounds_limits test_multiple_zbounds test_diag_generalized_indices check_diag_generalized_indices

# This is the source code for the test.
test_output_every_freq_SOURCES = test_output_every_freq.F90
Expand Down Expand Up @@ -71,6 +71,8 @@ test_diag_attribute_add_SOURCES = test_diag_attribute_add.F90
check_new_file_freq_SOURCES = check_new_file_freq.F90
test_zbounds_limits_SOURCES = test_zbounds_limits.F90
test_multiple_zbounds_SOURCES = test_multiple_zbounds.F90
test_diag_generalized_indices_SOURCES = testing_utils.F90 test_diag_generalized_indices.F90
check_diag_generalized_indices_SOURCES = testing_utils.F90 check_diag_generalized_indices.F90

TEST_EXTENSIONS = .sh
SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
Expand Down
99 changes: 99 additions & 0 deletions test_fms/diag_manager/check_diag_generalized_indices.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
!***********************************************************************
!* Apache License 2.0
!*
!* This file is part of the GFDL Flexible Modeling System (FMS).
!*
!* Licensed under the Apache License, Version 2.0 (the "License");
!* you may not use this file except in compliance with the License.
!* You may obtain a copy of the License at
!*
!* http://www.apache.org/licenses/LICENSE-2.0
!*
!* FMS is distributed in the hope that it will be useful, but WITHOUT
!* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied;
!* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
!* PARTICULAR PURPOSE. See the License for the specific language
!* governing permissions and limitations under the License.
!***********************************************************************

!> @brief Checker for test_generalized_indices output.
!! Verifies permuted-axis variables match identity variables under axis permutations
program check_diag_generalized_indices
use fms_mod, only: fms_init, fms_end, string
use testing_utils, only: check_perm
use fms2_io_mod, only: FmsNetcdfFile_t, read_data, open_file, close_file, get_global_attribute
use mpp_mod, only: mpp_error, FATAL, mpp_pe
use platform_mod, only: r8_kind

implicit none

type(FmsNetcdfFile_t) :: fileobj
integer :: nx, ny, nz
integer :: i, ierr

real(kind=r8_kind), allocatable :: var2_id(:,:) ! (x,y)
real(kind=r8_kind), allocatable :: var2_yx(:,:) ! (y,x)
real(kind=r8_kind), allocatable :: var3_id(:,:,:) ! (x,y,z)
real(kind=r8_kind), allocatable :: var3_zx(:,:,:) ! (z,y,x)
real(kind=r8_kind), allocatable :: var3_yzx(:,:,:) ! (y,z,x)
real(kind=r8_kind), allocatable :: var3_zxy(:,:,:) ! (z,x,y)

call fms_init()

nx = 96
ny = 96
nz = 5

if (.not. open_file(fileobj, "test_gen.nc", "read")) &
call mpp_error(FATAL, "unable to open test_gen.nc")

call check_global_attribute(fileobj, "test_generalized_indices")

allocate(var2_id(nx,ny), var2_yx(ny,nx))
allocate(var3_id(nx,ny,nz), var3_zx(nz,ny,nx), var3_yzx(ny,nz,nx), var3_zxy(nz,nx,ny))

! Output every 6 hours over 48 hours => 8 records
do i = 1, 8
var2_id = -999._r8_kind
var2_yx = -999._r8_kind
var3_id = -999._r8_kind
var3_zx = -999._r8_kind
var3_yzx = -999._r8_kind
var3_zxy = -999._r8_kind

print *, "Checking var2_yx vs var2_id - time_level:", i
call read_data(fileobj, "var2_id", var2_id, unlim_dim_level=i)
call read_data(fileobj, "var2_yx", var2_yx, unlim_dim_level=i)
call check_perm(var2_id, var2_yx, [2,1], ierr)

print *, "Checking var3_zx vs var3_id - time_level:", i
call read_data(fileobj, "var3_id", var3_id, unlim_dim_level=i)
call read_data(fileobj, "var3_zx", var3_zx, unlim_dim_level=i)
call check_perm(var3_id, var3_zx, [3,2,1], ierr)

print *, "Checking var3_yzx vs var3_id - time_level:", i
call read_data(fileobj, "var3_yzx", var3_yzx, unlim_dim_level=i)
call check_perm(var3_id, var3_yzx, [2,3,1], ierr)

print *, "Checking var3_zxy vs var3_id - time_level:", i
call read_data(fileobj, "var3_zxy", var3_zxy, unlim_dim_level=i)
call check_perm(var3_id, var3_zxy, [3,1,2], ierr)
enddo

call close_file(fileobj)
call fms_end()

contains

subroutine check_global_attribute(fileobj, expected_title)
type(FmsNetcdfFile_t), intent(in) :: fileobj
character(len=*), intent(in) :: expected_title

character(len=100) :: attribute_value

call get_global_attribute(fileobj, "title", attribute_value)
if (trim(attribute_value) .ne. trim(expected_title)) then
call mpp_error(FATAL, "Global attribute 'title' not expected value.")
endif
end subroutine check_global_attribute
end program check_diag_generalized_indices
Loading
Loading