Skip to content

Commit

Permalink
fix: modern diag manager allocation failures when using two empty fil…
Browse files Browse the repository at this point in the history
…es (#1503)
  • Loading branch information
uramirez8707 authored May 9, 2024
1 parent c422d44 commit 03a9c74
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
3 changes: 2 additions & 1 deletion diag_manager/fms_diag_yaml.F90
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,7 @@ subroutine diag_yaml_object_init(diag_subset_output)
else
call diag_get_value_from_key(diag_yaml_id, diag_file_ids(i), "file_name", filename)
call mpp_error(NOTE, "diag_manager_mod:: the file:"//trim(filename)//" has no variables defined. Ignoring!")
if (allocated(filename)) deallocate(filename)
ignore(i) = .True.
endif
endif
Expand Down Expand Up @@ -1748,7 +1749,7 @@ subroutine fms_diag_yaml_out()
tmpstr1 = ''; tmpstr1 = string(varptr%n_diurnal)
call fms_f2c_string(vals3(key3_i)%val9, tmpstr1)
endif

if( varptr%pow_value .gt. 0) then
tmpstr1 = ''; tmpstr1 = string(varptr%pow_value)
call fms_f2c_string(vals3(key3_i)%val10, tmpstr1)
Expand Down
18 changes: 18 additions & 0 deletions test_fms/diag_manager/test_time_none.sh
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,24 @@ test_expect_success "Testing diag manager that defined a diag file with no varia
mpirun -n 6 ../test_reduction_methods
'

cat <<_EOF > diag_table.yaml
title: test_none
base_date: 2 1 1 0 0 0
diag_files:
- file_name: test_empty_file
time_units: hours
unlimdim: time
freq: 6 hours
- file_name: test_empty_file2
time_units: hours
unlimdim: time
freq: 6 hours
_EOF

my_test_count=`expr $my_test_count + 1`
test_expect_success "Testing diag manager that defined 2 diag file with no variables (test $my_test_count)" '
mpirun -n 6 ../test_reduction_methods
'
cat <<_EOF > diag_table.yaml
title: test_none
base_date: 2 1 1 0 0 0
Expand Down

0 comments on commit 03a9c74

Please sign in to comment.