Skip to content

Commit

Permalink
fix: modern diag manager time_bnds issue when running for 1 day and r…
Browse files Browse the repository at this point in the history
…unning daily data (NOAA-GFDL#1523)
  • Loading branch information
uramirez8707 authored May 17, 2024
1 parent 42f8506 commit 6933c96
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
6 changes: 2 additions & 4 deletions diag_manager/fms_diag_file_object.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1473,10 +1473,8 @@ subroutine write_time_data(this)
diag_file => this%FMS_diag_file
fms2io_fileobj => diag_file%fms2io_fileobj

!< If data has not been written for the current unlimited dimension
!! ignore this. The diag_file%unlim_dimension_level .ne. 1 is there to ensure
!! that at least one time level is written (this is needed for the combiner)
if (.not. diag_file%data_has_been_written .and. diag_file%unlim_dimension_level .ne. 1) return
!< If data has not been written for the current unlimited dimension leave the subroutine
if (.not. diag_file%data_has_been_written) return

if (diag_file%get_time_ops()) then
middle_time = (diag_file%last_output+diag_file%next_output)/2
Expand Down
9 changes: 9 additions & 0 deletions test_fms/diag_manager/check_var_masks.F90
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ program check_var_masks
real :: ans_var_mask
real :: ans_var
integer :: i, j
real :: time_data(2)

call fms_init()

Expand All @@ -49,6 +50,14 @@ program check_var_masks
call get_dimension_size(fileobj, "y", ny)
if (ny .ne. 180) call mpp_error(FATAL, "y is not the correct size!")

call read_data(fileobj, "time", time_data(1))
if (time_data(1) .ne. real(12.))&
call mpp_error(FATAL, "The time data is not the expected result")

call read_data(fileobj, "time_bnds", time_data)
if (time_data(1) .ne. real(0.) .or. time_data(2) .ne. real(24.)) &
call mpp_error(FATAL, "The time bnds data is not the expected result")

allocate(vardata(nx,ny))

ans_var_mask = 0.
Expand Down

0 comments on commit 6933c96

Please sign in to comment.