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

Modern_diag_manager:: 0 days freq, mix_snapshot_average_fields deprecation #1500

Merged
merged 4 commits into from
May 9, 2024
Merged
Changes from 1 commit
Commits
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
Next Next commit
implement the 0days freq capability in the modern diag manager
uramirez8707 committed May 7, 2024
commit f1a35eab17a0d35cc8991e93accf8ecb302fe99c
12 changes: 10 additions & 2 deletions diag_manager/diag_manager.F90
Original file line number Diff line number Diff line change
@@ -1769,6 +1769,10 @@ LOGICAL FUNCTION diag_send_data(diag_field_id, field, time, is_in, js_in, ks_in,
& SIZE(field,1), SIZE(field,2), SIZE(field,3), status
IF ( fms_error_handler('diag_manager_mod::send_data_3d', err_msg_local, err_msg) ) RETURN
END IF
if (use_modern_diag) then !> Set up array lengths for remapping


endif
SELECT TYPE (field)
TYPE IS (real(kind=r4_kind))
field_out = field
@@ -4169,11 +4173,15 @@ SUBROUTINE diag_manager_init(diag_model_subset, time_init, err_msg)
END IF

IF ( mix_snapshot_average_fields ) THEN
IF ( mpp_pe() == mpp_root_pe() ) THEN
IF ( .not. use_modern_diag ) THEN
CALL error_mesg('diag_manager_mod::diag_manager_init', 'Setting diag_manager_nml variable '//&
& 'mix_snapshot_average_fields = .TRUE. will cause ERRORS in the time coordinates '//&
& 'of all time averaged fields. Strongly recommend setting mix_snapshot_average_fields '//&
& '= .FALSE.', WARNING)
& '= .FALSE.', NOTE)
ELSE
CALL error_mesg('diag_manager_mod::diag_manager_init', 'mix_snapshot_average_fields = .TRUE. is not '//&
& 'supported if use_modern_diag = .TRUE. Please set mix_snapshot_average_fields '//&
& 'to .FALSE. and put instantaneous and averaged fields in seperate files!', FATAL)
END IF
END IF
ALLOCATE(output_fields(max_output_fields))
59 changes: 53 additions & 6 deletions diag_manager/fms_diag_file_object.F90
Original file line number Diff line number Diff line change
@@ -158,6 +158,7 @@ module fms_diag_file_object_mod
procedure, public :: get_buffer_ids
procedure, public :: get_number_of_buffers
procedure, public :: has_send_data_been_called
procedure, public :: check_buffer_times
end type fmsDiagFile_type

type, extends (fmsDiagFile_type) :: subRegionalFile_type
@@ -382,10 +383,17 @@ subroutine set_file_time_ops(this, VarYaml, is_static)
endif
else
var_reduct = VarYaml%get_var_reduction()
select case (var_reduct)
case (time_average, time_rms, time_max, time_min, time_sum, time_diurnal, time_power)
this%time_ops = .true.
end select
if (this%num_registered_fields .eq. 1) then
select case (var_reduct)
case (time_average, time_rms, time_max, time_min, time_sum, time_diurnal, time_power)
this%time_ops = .true.
end select
else
if (var_reduct .ne. time_none .and. .not. is_static) &
call mpp_error(FATAL, "The file: "//this%get_file_fname()//&
" has variables that are time averaged and instantaneous")
endif

endif

end subroutine set_file_time_ops
@@ -1366,17 +1374,31 @@ logical function is_time_to_close_file (this, time_step)
end function

!> \brief Determine if it is time to "write" to the file
logical function is_time_to_write(this, time_step, output_buffers)
logical function is_time_to_write(this, time_step, output_buffers, do_not_write)
class(fmsDiagFileContainer_type), intent(inout), target :: this !< The file object
TYPE(time_type), intent(in) :: time_step !< Current model step time
type(fmsDiagOutputBuffer_type), intent(in) :: output_buffers(:) !< Array of output buffer.
!! This is needed for error messages!
logical, intent(out) :: do_not_write !< .True. only if this is not a new
!! time step and you are writting
!! at every time step

do_not_write = .false.
if (time_step > this%FMS_diag_file%next_output) then
is_time_to_write = .true.
if (this%FMS_diag_file%is_static) return
if (time_step > this%FMS_diag_file%next_next_output) then
if (this%FMS_diag_file%num_registered_fields .eq. 0) then
if (this%FMS_diag_file%get_file_freq() .eq. 0) then
!! If the diag file is being written at every time step
if (time_step .ne. this%FMS_diag_file%next_output) then
!! Only write and update the next_output if it is a new time
call this%FMS_diag_file%check_buffer_times(output_buffers)
this%FMS_diag_file%next_output = time_step
this%FMS_diag_file%next_next_output = time_step
is_time_to_write = .true.
endif
return
elseif (this%FMS_diag_file%num_registered_fields .eq. 0) then
!! If no variables have been registered, write a dummy time dimension for the first level
!! At least one time level is needed for the combiner to work ...
if (this%FMS_diag_file%unlim_dimension_level .eq. 0) then
@@ -1400,6 +1422,8 @@ logical function is_time_to_write(this, time_step, output_buffers)
if (this%FMS_diag_file%is_static) then
! This is to ensure that static files get finished in the begining of the run
if (this%FMS_diag_file%unlim_dimension_level .eq. 1) is_time_to_write = .true.
else if(this%FMS_diag_file%get_file_freq() .eq. 0) then
do_not_write = .true.
endif
endif
end function is_time_to_write
@@ -1788,6 +1812,29 @@ pure function get_number_of_buffers(this)
get_number_of_buffers = this%number_of_buffers
end function get_number_of_buffers

!> Check to ensure that send_data was called at the time step for every output buffer in the file
!! This is only needed when you are output data at every time step
subroutine check_buffer_times(this, output_buffers)
class(fmsDiagFile_type), intent(in) :: this !< file object
type(fmsDiagOutputBuffer_type), intent(in), target :: output_buffers(:) !< Array of output buffers

integer :: i
type(time_type) :: current_buffer_time
character(len=:), allocatable :: field_name

do i = 1, this%number_of_buffers
if (i .eq. 1) then
current_buffer_time = output_buffers(this%buffer_ids(i))%get_buffer_time()
field_name = output_buffers(this%buffer_ids(i))%get_buffer_name()
else
if (current_buffer_time .ne. output_buffers(this%buffer_ids(i))%get_buffer_time()) &
call mpp_error(FATAL, "Send data has not been called at the same time steps for the fields:"//&
field_name//" and "//output_buffers(this%buffer_ids(i))%get_buffer_name()//&
" in file:"//this%get_file_fname())
endif
enddo
end subroutine

!> @brief Determine if send_data has been called for any fields in the file. Prints out warnings, if indicated
!! @return .True. if send_data has been called for any fields in the file
function has_send_data_been_called(this, output_buffers, print_warnings, diag_fields) &
5 changes: 3 additions & 2 deletions diag_manager/fms_diag_object.F90
Original file line number Diff line number Diff line change
@@ -807,6 +807,7 @@ subroutine fms_diag_do_io(this, end_time)
real(r8_kind) :: mval !< r8 copy of missing value
character(len=128) :: error_string !< outputted error string from reducti
logical :: unlim_dim_was_increased !< .True. if the unlimited dimension index was increased for any of the buffers
logical :: do_not_write !< .True. only if this is not a new time step and you are writting at every time step

force_write = .false.

@@ -836,7 +837,7 @@ subroutine fms_diag_do_io(this, end_time)
call diag_file%write_axis_data(this%diag_axis)
endif

finish_writing = diag_file%is_time_to_write(model_time, this%FMS_diag_output_buffers)
finish_writing = diag_file%is_time_to_write(model_time, this%FMS_diag_output_buffers, do_not_write)
unlim_dim_was_increased = .false.

! finish reduction method if its time to write
@@ -850,7 +851,7 @@ subroutine fms_diag_do_io(this, end_time)
! Go away if there is no data to write
if (.not. diag_buff%is_there_data_to_write()) cycle

if ( diag_buff%is_time_to_finish_reduction(end_time)) then
if ( diag_buff%is_time_to_finish_reduction(end_time) .and. .not. do_not_write) then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahhh a double negative

! sets missing value
mval = diag_field%find_missing_value(missing_val)
! time_average and greater values all involve averaging so need to be "finished" before written
23 changes: 23 additions & 0 deletions diag_manager/fms_diag_output_buffer.F90
Original file line number Diff line number Diff line change
@@ -67,6 +67,7 @@ module fms_diag_output_buffer_mod
type(time_type) :: next_output !< The next time to output the data

contains
procedure :: get_buffer_name
procedure :: add_axis_ids
procedure :: get_axis_ids
procedure :: set_field_id
@@ -76,6 +77,7 @@ module fms_diag_output_buffer_mod
procedure :: init_buffer_time
procedure :: set_next_output
procedure :: update_buffer_time
procedure :: get_buffer_time
procedure :: is_there_data_to_write
procedure :: is_time_to_finish_reduction
procedure :: set_send_data_called
@@ -301,6 +303,17 @@ subroutine initialize_buffer (this, reduction_method, field_name)

end subroutine initialize_buffer

!> @brief Get the name of the field for the output buffer
!! @return Name of the field for the output buffer
function get_buffer_name(this) &
result(rslt)
class(fmsDiagOutputBuffer_type), intent(in) :: this !< Buffer object

character(len=:), allocatable :: rslt

rslt = diag_yaml%diag_fields(this%yaml_id)%get_var_outname()
end function get_buffer_name

!> @brief Adds the axis ids to the buffer object
subroutine add_axis_ids(this, axis_ids)
class(fmsDiagOutputBuffer_type), intent(inout) :: this !< Buffer object
@@ -400,6 +413,16 @@ subroutine update_buffer_time(this, time)
endif
end subroutine update_buffer_time

!> @brief Get the buffer_time from a output buffer object
!! @return The buffer time
function get_buffer_time(this) &
result(rslt)
class(fmsDiagOutputBuffer_type), intent(in) :: this !< Buffer object
type(time_type) :: rslt

rslt = this%time
end function get_buffer_time

!> @brief Determine if finished with math
!! @return this%done_with_math
function is_done_with_math(this) &
17 changes: 15 additions & 2 deletions diag_manager/fms_diag_yaml.F90
Original file line number Diff line number Diff line change
@@ -368,7 +368,10 @@ subroutine diag_yaml_object_init(diag_subset_output)
integer :: file_count !! The current number of files added to the diag_yaml obj
logical :: write_file !< Flag indicating if the user wants the file to be written
logical :: write_var !< Flag indicating if the user wants the variable to be written
logical :: allow_averages !< .True. if averages are allowed (the file is not static of you are
!! outputing data at every frequency)
character(len=:), allocatable :: filename!< Diag file name (for error messages)
logical :: is_instantaneous !< .True. if the file is instantaneous (i.e no averaging)

if (diag_yaml_module_initialized) return

@@ -447,6 +450,8 @@ subroutine diag_yaml_object_init(diag_subset_output)
file_var_count = 0
allocate(diag_yaml%diag_files(file_count)%file_varlist(get_total_num_vars(diag_yaml_id, diag_file_ids(i))))
allocate(diag_yaml%diag_files(file_count)%file_outlist(get_total_num_vars(diag_yaml_id, diag_file_ids(i))))
allow_averages = .not. diag_yaml%diag_files(file_count)%file_freq(1) < 1
is_instantaneous = .false.
nvars_loop: do j = 1, nvars
write_var = .true.
call get_value_from_key(diag_yaml_id, var_ids(j), "write_var", write_var, is_optional=.true.)
@@ -462,7 +467,7 @@ subroutine diag_yaml_object_init(diag_subset_output)
diag_yaml%diag_fields(var_count)%var_axes_names = ""
diag_yaml%diag_fields(var_count)%var_file_is_subregional = diag_yaml%diag_files(file_count)%has_file_sub_region()

call fill_in_diag_fields(diag_yaml_id, var_ids(j), diag_yaml%diag_fields(var_count))
call fill_in_diag_fields(diag_yaml_id, var_ids(j), diag_yaml%diag_fields(var_count), allow_averages)

!> Save the variable name in the diag_file type
diag_yaml%diag_files(file_count)%file_varlist(file_var_count) = diag_yaml%diag_fields(var_count)%var_varname
@@ -602,10 +607,11 @@ subroutine fill_in_diag_files(diag_yaml_id, diag_file_id, yaml_fileobj)

!> @brief Fills in a diagYamlFilesVar_type with the contents of a variable block in
!! diag_table.yaml
subroutine fill_in_diag_fields(diag_file_id, var_id, field)
subroutine fill_in_diag_fields(diag_file_id, var_id, field, allow_averages)
integer, intent(in) :: diag_file_id !< Id of the file block in the yaml file
integer, intent(in) :: var_id !< Id of the variable block in the yaml file
type(diagYamlFilesVar_type), intent(inout) :: field !< diagYamlFilesVar_type obj to read the contents into
logical, intent(in) :: allow_averages !< .True. if averages are allowed for this file

integer :: natt !< Number of attributes in variable
integer :: var_att_id(1) !< Id of the variable attribute block
@@ -619,6 +625,13 @@ subroutine fill_in_diag_fields(diag_file_id, var_id, field)
call diag_get_value_from_key(diag_file_id, var_id, "reduction", buffer)
call set_field_reduction(field, buffer)

if (.not. allow_averages) then
if (field%var_reduction .ne. time_none) &
call mpp_error(FATAL, "The file "//field%var_fname//" can only have variables that have none as "//&
"the reduction method because the frequency is either -1 or 0. "//&
"Check your diag_table.yaml for the field:"//trim(field%var_varname))
endif

call diag_get_value_from_key(diag_file_id, var_id, "module", field%var_module)
deallocate(buffer)
call diag_get_value_from_key(diag_file_id, var_id, "kind", buffer)
8 changes: 5 additions & 3 deletions test_fms/diag_manager/Makefile.am
Original file line number Diff line number Diff line change
@@ -33,9 +33,10 @@ check_PROGRAMS = test_diag_manager test_diag_manager_time \
test_flexible_time test_diag_update_buffer test_reduction_methods check_time_none \
check_time_min check_time_max check_time_sum check_time_avg test_diag_diurnal check_time_diurnal \
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
check_var_masks test_multiple_send_data test_diag_out_yaml test_output_every_freq

# This is the source code for the test.
test_output_every_freq_SOURCES = test_output_every_freq.F90
test_diag_manager_SOURCES = test_diag_manager.F90
test_diag_manager_time_SOURCES = test_diag_manager_time.F90
test_diag_update_buffer_SOURCES= test_diag_update_buffer.F90
@@ -68,14 +69,15 @@ SH_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
# Run the test.
TESTS = test_diag_manager2.sh test_time_none.sh test_time_min.sh test_time_max.sh test_time_sum.sh \
test_time_avg.sh test_time_pow.sh test_time_rms.sh test_time_diurnal.sh test_cell_measures.sh \
test_subregional.sh test_var_masks.sh test_multiple_send_data.sh
test_subregional.sh test_var_masks.sh test_multiple_send_data.sh test_output_every_freq.sh

testing_utils.mod: testing_utils.$(OBJEXT)

# Copy over other needed files to the srcdir
EXTRA_DIST = test_diag_manager2.sh check_crashes.sh test_time_none.sh test_time_min.sh test_time_max.sh \
test_time_sum.sh test_time_avg.sh test_time_pow.sh test_time_rms.sh test_time_diurnal.sh \
test_cell_measures.sh test_subregional.sh test_var_masks.sh test_multiple_send_data.sh
test_cell_measures.sh test_subregional.sh test_var_masks.sh test_multiple_send_data.sh \
test_output_every_freq.sh

if USING_YAML
skipflag=""
4 changes: 2 additions & 2 deletions test_fms/diag_manager/test_diag_manager2.sh
Original file line number Diff line number Diff line change
@@ -560,13 +560,13 @@ diag_files:
- module: test_diag_manager_mod
var_name: sstt
output_name: sstt
reduction: average
reduction: none
kind: r4
long_name: S S T
- module: test_diag_manager_mod
var_name: sstt2
output_name: sstt2
reduction: average
reduction: none
kind: r4
long_name: S S T
write_var: false
4 changes: 2 additions & 2 deletions test_fms/diag_manager/test_diag_yaml.F90
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ program test_diag_yaml
use fms_diag_yaml_mod
use diag_data_mod, only: DIAG_NULL, DIAG_ALL, get_base_year, get_base_month, get_base_day, get_base_hour, &
& get_base_minute, get_base_second, diag_data_init, DIAG_HOURS, DIAG_NULL, DIAG_DAYS, &
& time_average, r4, middle_time, end_time
& time_average, r4, middle_time, end_time, time_none
use time_manager_mod, only: set_calendar_type, JULIAN
use mpp_mod
use platform_mod
@@ -165,7 +165,7 @@ subroutine compare_diag_fields(res)

call compare_result("var_reduction 1", res(1)%get_var_reduction(), time_average)
call compare_result("var_reduction 2", res(2)%get_var_reduction(), time_average)
call compare_result("var_reduction 3", res(3)%get_var_reduction(), time_average)
call compare_result("var_reduction 3", res(3)%get_var_reduction(), time_none)

call compare_result("var_module 1", res(1)%get_var_module(), "test_diag_manager_mod")
call compare_result("var_module 2", res(2)%get_var_module(), "test_diag_manager_mod")
92 changes: 92 additions & 0 deletions test_fms/diag_manager/test_output_every_freq.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
!***********************************************************************
!* GNU Lesser General Public License
!*
!* This file is part of the GFDL Flexible Modeling System (FMS).
!*
!* FMS is free software: you can redistribute it and/or modify it under
!* the terms of the GNU Lesser General Public License as published by
!* the Free Software Foundation, either version 3 of the License, or (at
!* your option) any later version.
!*
!* FMS is distributed in the hope that it will be useful, but WITHOUT
!* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
!* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
!* for more details.
!*
!* You should have received a copy of the GNU Lesser General Public
!* License along with FMS. If not, see <http://www.gnu.org/licenses/>.
!***********************************************************************

!> @brief This programs tests diag manager when the file frequency is set to 0 days
program test_output_every_freq

use fms_mod, only: fms_init, fms_end, string
use diag_manager_mod, only: diag_axis_init, send_data, diag_send_complete, diag_manager_set_time_end, &
register_diag_field, diag_manager_init, diag_manager_end
use time_manager_mod, only: time_type, operator(+), JULIAN, set_time, set_calendar_type, set_date
use mpp_mod, only: FATAL, mpp_error
use fms2_io_mod, only: FmsNetcdfFile_t, open_file, close_file, read_data, get_dimension_size

implicit none

integer :: id_var0, id_var1 !< diag field ids
logical :: used !< for send_data calls
integer :: ntimes = 48 !< Number of time steps
real :: vdata !< Buffer to store the data
type(time_type) :: Time !< "Model" time
type(time_type) :: Time_step !< Time step for the "simulation"
integer :: i !< For do loops

call fms_init
call set_calendar_type(JULIAN)
call diag_manager_init

Time = set_date(2,1,1,0,0,0)
Time_step = set_time (3600,0) !< 1 hour
call diag_manager_set_time_end(set_date(2,1,3,0,0,0))

id_var0 = register_diag_field ('ocn_mod', 'var0', Time)
id_var1 = register_diag_field ('ocn_mod', 'var1', Time)

do i = 1, ntimes
Time = Time + Time_step
vdata = real(i)

used = send_data(id_var0, vdata, Time) !< Sending data every hour!
if (mod(i,2) .eq. 0) used = send_data(id_var1, vdata, Time) !< Sending data every two hours!

call diag_send_complete(Time_step)
enddo

call diag_manager_end(Time)

call check_output()
call fms_end

contains

!< @brief Check the diag manager output
subroutine check_output()
type(FmsNetcdfFile_t) :: fileobj !< Fms2io fileobj
integer :: var_size !< Size of the variable reading
real, allocatable :: var_data(:) !< Buffer to read variable data to
integer :: j !< For looping

if (.not. open_file(fileobj, "test_0days.nc", "read")) &
call mpp_error(FATAL, "Error opening file:test_0days.nc to read")

call get_dimension_size(fileobj, "time", var_size)
if (var_size .ne. 48) call mpp_error(FATAL, "The dimension of time in the file:test_0days is not the "//&
"correct size!")
allocate(var_data(var_size))
var_data = -999.99

call read_data(fileobj, "var0", var_data)
do j = 1, var_size
if (var_data(j) .ne. real(j)) call mpp_error(FATAL, "The variable data for var1 at time level:"//&
string(j)//" is not the correct value!")
enddo

call close_file(fileobj)
end subroutine check_output
end program test_output_every_freq
116 changes: 116 additions & 0 deletions test_fms/diag_manager/test_output_every_freq.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
#!/bin/sh

#***********************************************************************
#* GNU Lesser General Public License
#*
#* This file is part of the GFDL Flexible Modeling System (FMS).
#*
#* FMS is free software: you can redistribute it and/or modify it under
#* the terms of the GNU Lesser General Public License as published by
#* the Free Software Foundation, either version 3 of the License, or (at
#* your option) any later version.
#*
#* FMS is distributed in the hope that it will be useful, but WITHOUT
#* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
#* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
#* for more details.
#*
#* You should have received a copy of the GNU Lesser General Public
#* License along with FMS. If not, see <http://www.gnu.org/licenses/>.
#***********************************************************************

# Copyright (c) 2019-2020 Ed Hartnett, Seth Underwood

# Set common test settings.
. ../test-lib.sh

if [ -z "${skipflag}" ]; then
# create and enter directory for in/output files
output_dir

cat <<_EOF > diag_table.yaml
title: test_diag_manager_01
base_date: 2 1 1 0 0 0
diag_files:
- file_name: test_0days
time_units: days
unlimdim: time
freq: 0 days
varlist:
- module: ocn_mod
var_name: var0
reduction: none
kind: r4
_EOF

my_test_count=1
printf "&diag_manager_nml \n use_modern_diag=.true. \n / \n&test_reduction_methods_nml \n test_case = 0 \n/" | cat > input.nml
test_expect_success "Running diag_manager with 0 days frequency (test $my_test_count)" '
mpirun -n 1 ../test_output_every_freq
'

cat <<_EOF > diag_table.yaml
title: test_diag_manager_01
base_date: 2 1 1 0 0 0
diag_files:
- file_name: test_0days
time_units: days
unlimdim: time
freq: 0 days
varlist:
- module: ocn_mod
var_name: var0
reduction: none
kind: r4
- module: ocn_mod
var_name: var1
reduction: none
kind: r4
_EOF

my_test_count=`expr $my_test_count + 1`
test_expect_failure "Running diag_manager with 0 days frequency and variable are calling send data at different frequencies (test $my_test_count)" '
mpirun -n 1 ../test_output_every_freq
'

cat <<_EOF > diag_table.yaml
title: test_diag_manager_01
base_date: 2 1 1 0 0 0
diag_files:
- file_name: test_0days
time_units: days
unlimdim: time
freq: 0 days
varlist:
- module: ocn_mod
var_name: var0
reduction: average
kind: r4
_EOF

my_test_count=`expr $my_test_count + 1`
test_expect_failure "Running diag_manager with 0 days frequency but using average reduction method (test $my_test_count)" '
mpirun -n 1 ../test_output_every_freq
'

cat <<_EOF > diag_table.yaml
title: test_diag_manager_01
base_date: 2 1 1 0 0 0
diag_files:
- file_name: test_0days
time_units: days
unlimdim: time
freq: -1 days
varlist:
- module: ocn_mod
var_name: var0
reduction: average
kind: r4
_EOF

my_test_count=`expr $my_test_count + 1`
test_expect_failure "Running diag_manager with -1 days frequency but using average reduction method (test $my_test_count)" '
mpirun -n 1 ../test_output_every_freq
'
fi
test_done
33 changes: 33 additions & 0 deletions test_fms/diag_manager/test_time_avg.sh
Original file line number Diff line number Diff line change
@@ -192,6 +192,39 @@ test_expect_success "Checking answers for the "avg" reduction method with halo o
mpirun -n 1 ../check_time_avg
'

my_test_count=`expr $my_test_count + 1`
printf "&diag_manager_nml \n use_modern_diag=.true. \n mix_snapshot_average_fields = .true. \n /" | cat > input.nml
test_expect_failure "Running diag_manager with with mix_snapshot_average_fields = .true. (test $my_test_count)" '
mpirun -n 6 ../test_reduction_methods
'

cat <<_EOF > diag_table.yaml
title: test_avg
base_date: 2 1 1 0 0 0
diag_files:
- file_name: test_avg
time_units: hours
unlimdim: time
freq: 6 hours
varlist:
- module: ocn_mod
var_name: var0
output_name: var0_avg
reduction: average
kind: r4
- module: ocn_mod
var_name: var0
output_name: var0_none
reduction: none
kind: r4
_EOF

my_test_count=`expr $my_test_count + 1`
printf "&diag_manager_nml \n use_modern_diag=.true. \n /" | cat > input.nml
test_expect_failure "Running diag_manager with with a file with instantaneous and averaged output (test $my_test_count)" '
mpirun -n 6 ../test_reduction_methods
'

cat <<_EOF > diag_table.yaml
title: test_avg
base_date: 2 1 1 0 0 0