@@ -151,7 +151,7 @@ module mosart_histfile
151151 type (file_desc_t), target :: nfid(max_tapes) ! file ids
152152 type (file_desc_t), target :: ncid_hist(max_tapes) ! file ids for history restart files
153153 integer :: time_dimid ! time dimension id
154- integer :: hist_interval_dimid ! time bounds dimension id
154+ integer :: nbnd_dimid ! time bounds dimension id
155155 integer :: strlen_dimid ! string dimension id
156156 !- ----------------------------------------------------------------------
157157
@@ -697,7 +697,7 @@ subroutine htape_create (t, histrest)
697697 call ncd_defdim(lnfid, ' string_length' , 8 , strlen_dimid)
698698
699699 if ( .not. lhistrest )then
700- call ncd_defdim(lnfid, ' hist_interval ' , 2 , hist_interval_dimid )
700+ call ncd_defdim(lnfid, ' nbnd ' , 2 , nbnd_dimid )
701701 call ncd_defdim(lnfid, ' time' , ncd_unlimited, time_dimid)
702702 if (mainproc)then
703703 write (iulog,* ) trim (subname),' : Successfully defined netcdf history file ' ,t
@@ -766,7 +766,7 @@ subroutine htape_timeconst(t, mode)
766766
767767 dim1id(1 ) = time_dimid
768768 str = ' days since ' // basedate // " " // basesec
769- if (tape (t)% hlist( 1 ) % avgflag /= ' I' ) then ! NOT instantaneous fields tape
769+ if (avgflag_pertape (t) /= ' I' ) then ! NOT instantaneous fields tape
770770 step_or_bounds = ' time_bounds'
771771 long_name = ' time at exact middle of ' // step_or_bounds
772772 call ncd_defvar(nfid(t), ' time' , tape(t)% ncprec, 1 , dim1id, varid, &
@@ -790,22 +790,28 @@ subroutine htape_timeconst(t, mode)
790790 long_name = ' current date (YYYYMMDD) at end of ' // step_or_bounds
791791 call ncd_defvar(nfid(t) , ' mcdate' , ncd_int, 1 , dim1id , varid, &
792792 long_name = long_name)
793+ call ncd_putatt(nfid(t), varid, ' calendar' , caldesc)
793794 long_name = ' current seconds of current date at end of ' // step_or_bounds
794795 call ncd_defvar(nfid(t) , ' mcsec' , ncd_int, 1 , dim1id , varid, &
795796 long_name = long_name, units= ' s' )
797+ call ncd_putatt(nfid(t), varid, ' calendar' , caldesc)
796798 long_name = ' current day (from base day) at end of ' // step_or_bounds
797799 call ncd_defvar(nfid(t) , ' mdcur' , ncd_int, 1 , dim1id , varid, &
798800 long_name = long_name)
801+ call ncd_putatt(nfid(t), varid, ' calendar' , caldesc)
799802 long_name = ' current seconds of current day at end of ' // step_or_bounds
800803 call ncd_defvar(nfid(t) , ' mscur' , ncd_int, 1 , dim1id , varid, &
801804 long_name = long_name)
805+ call ncd_putatt(nfid(t), varid, ' calendar' , caldesc)
802806 call ncd_defvar(nfid(t) , ' nstep' , ncd_int, 1 , dim1id , varid, &
803807 long_name = ' time step' )
804808
805- dim2id(1 ) = hist_interval_dimid ; dim2id(2 ) = time_dimid
806- if (tape (t)% hlist( 1 ) % avgflag /= ' I' ) then ! NOT instantaneous fields tape
809+ dim2id(1 ) = nbnd_dimid ; dim2id(2 ) = time_dimid
810+ if (avgflag_pertape (t) /= ' I' ) then ! NOT instantaneous fields tape
807811 call ncd_defvar(nfid(t), ' time_bounds' , ncd_double, 2 , dim2id, varid, &
808- long_name = ' history time interval endpoints' )
812+ long_name = ' time interval endpoints' , &
813+ units= str)
814+ call ncd_putatt(nfid(t), varid, ' calendar' , caldesc)
809815 end if
810816
811817 dim2id(1 ) = strlen_dimid; dim2id(2 ) = time_dimid
@@ -840,7 +846,7 @@ subroutine htape_timeconst(t, mode)
840846
841847 timedata(1 ) = tape(t)% begtime ! beginning time
842848 timedata(2 ) = mdcur + mscur / secspday ! end time
843- if (tape (t)% hlist( 1 ) % avgflag /= ' I' ) then ! NOT instantaneous fields tape
849+ if (avgflag_pertape (t) /= ' I' ) then ! NOT instantaneous fields tape
844850 time = (timedata(1 ) + timedata(2 )) * 0.5_r8
845851 call ncd_io(' time_bounds' , timedata, ' write' , nfid(t), nt= tape(t)% ntimes)
846852 else
0 commit comments