Skip to content

Commit

Permalink
Correct time-related fields that appear on instantaneous file
Browse files Browse the repository at this point in the history
  • Loading branch information
slevis-lmwg committed Jan 4, 2025
1 parent 16d1e29 commit f1b0685
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/histFileMod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -3416,13 +3416,13 @@ subroutine htape_timeconst(t, f, mode)

dim1id(1) = time_dimid
str = 'days since ' // basedate // " " // basesec
if (hist_avgflag_pertape(t) /= 'I') then ! NOT instantaneous fields tape
if (f == accumulated_file_index) then
step_or_bounds = 'time_bounds'
long_name = 'time at exact middle of ' // step_or_bounds
call ncd_defvar(nfid(t,f), 'time', tape(t)%ncprec, 1, dim1id, varid, &
long_name=long_name, units=str)
call ncd_putatt(nfid(t,f), varid, 'bounds', 'time_bounds')
else ! instantaneous fields tape
else ! instantaneous file
step_or_bounds = 'time step'
long_name = 'time at end of ' // step_or_bounds
call ncd_defvar(nfid(t,f), 'time', tape(t)%ncprec, 1, dim1id, varid, &
Expand Down Expand Up @@ -3479,7 +3479,7 @@ subroutine htape_timeconst(t, f, mode)
long_name = 'time step')

dim2id(1) = hist_interval_dimid; dim2id(2) = time_dimid
if (hist_avgflag_pertape(t) /= 'I') then ! NOT instantaneous fields tape
if (f == accumulated_file_index) then
call ncd_defvar(nfid(t,f), 'time_bounds', ncd_double, 2, dim2id, varid, &
long_name = 'history time interval endpoints')
end if
Expand Down Expand Up @@ -3512,10 +3512,10 @@ subroutine htape_timeconst(t, f, mode)

timedata(1) = tape(t)%begtime ! beginning time
timedata(2) = mdcur + mscur/secspday ! end time
if (hist_avgflag_pertape(t) /= 'I') then ! NOT instantaneous fields tape
if (f == accumulated_file_index) then
time = (timedata(1) + timedata(2)) * 0.5_r8
call ncd_io('time_bounds', timedata, 'write', nfid(t,f), nt=tape(t)%ntimes(f))
else
else ! instantaneous file
time = timedata(2)
end if
call ncd_io('time' , time , 'write', nfid(t,f), nt=tape(t)%ntimes(f))
Expand Down

0 comments on commit f1b0685

Please sign in to comment.