From 1262d53eb9ab498ae487fcfad794865b1276c820 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Mon, 10 Jul 2023 13:40:39 -0600 Subject: [PATCH 1/7] Standardize time_bounds long_name. --- src/riverroute/RtmHistFile.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/riverroute/RtmHistFile.F90 b/src/riverroute/RtmHistFile.F90 index 01eab6a..8bb5957 100644 --- a/src/riverroute/RtmHistFile.F90 +++ b/src/riverroute/RtmHistFile.F90 @@ -882,7 +882,7 @@ subroutine htape_timeconst(t, mode) dim2id(1) = hist_interval_dimid; dim2id(2) = time_dimid call ncd_defvar(nfid(t), 'time_bounds', ncd_double, 2, dim2id, varid, & - long_name = 'history time interval endpoints') + long_name = 'time interval endpoints') dim2id(1) = strlen_dimid; dim2id(2) = time_dimid call ncd_defvar(nfid(t), 'date_written', ncd_char, 2, dim2id, varid) From 41e4b8ac7e4b4730ac1d3a0a60914dbfbd957a4e Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Mon, 10 Jul 2023 13:41:39 -0600 Subject: [PATCH 2/7] Add units to time_bounds. --- src/riverroute/RtmHistFile.F90 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/riverroute/RtmHistFile.F90 b/src/riverroute/RtmHistFile.F90 index 8bb5957..70c2ee2 100644 --- a/src/riverroute/RtmHistFile.F90 +++ b/src/riverroute/RtmHistFile.F90 @@ -882,7 +882,8 @@ subroutine htape_timeconst(t, mode) dim2id(1) = hist_interval_dimid; dim2id(2) = time_dimid call ncd_defvar(nfid(t), 'time_bounds', ncd_double, 2, dim2id, varid, & - long_name = 'time interval endpoints') + long_name = 'time interval endpoints', & + units=str) dim2id(1) = strlen_dimid; dim2id(2) = time_dimid call ncd_defvar(nfid(t), 'date_written', ncd_char, 2, dim2id, varid) From b5dd0e364b30d4d9cfc6f7fa4c415ce7e531cdab Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Mon, 10 Jul 2023 13:42:53 -0600 Subject: [PATCH 3/7] Add calendar to time_bounds. --- src/riverroute/RtmHistFile.F90 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/riverroute/RtmHistFile.F90 b/src/riverroute/RtmHistFile.F90 index 70c2ee2..668b4d7 100644 --- a/src/riverroute/RtmHistFile.F90 +++ b/src/riverroute/RtmHistFile.F90 @@ -884,6 +884,7 @@ subroutine htape_timeconst(t, mode) call ncd_defvar(nfid(t), 'time_bounds', ncd_double, 2, dim2id, varid, & long_name = 'time interval endpoints', & units=str) + call ncd_putatt(nfid(t), varid, 'calendar', caldesc) dim2id(1) = strlen_dimid; dim2id(2) = time_dimid call ncd_defvar(nfid(t), 'date_written', ncd_char, 2, dim2id, varid) From d8d9030bd7cb978d0b5da1b2e11a09c81103e9eb Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Mon, 10 Jul 2023 13:44:08 -0600 Subject: [PATCH 4/7] Renamed dimension hist_interval to nbnd. Also renamed related dimid variable. --- src/riverroute/RtmHistFile.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/riverroute/RtmHistFile.F90 b/src/riverroute/RtmHistFile.F90 index 668b4d7..249fa59 100644 --- a/src/riverroute/RtmHistFile.F90 +++ b/src/riverroute/RtmHistFile.F90 @@ -177,7 +177,7 @@ module RtmHistFile type(file_desc_t), target :: nfid(max_tapes) ! file ids type(file_desc_t), target :: ncid_hist(max_tapes) ! file ids for history restart files integer :: time_dimid ! time dimension id - integer :: hist_interval_dimid ! time bounds dimension id + integer :: nbnd_dimid ! time bounds dimension id integer :: strlen_dimid ! string dimension id !----------------------------------------------------------------------- @@ -780,7 +780,7 @@ subroutine htape_create (t, histrest) call ncd_defdim(lnfid, 'string_length', 8, strlen_dimid) if ( .not. lhistrest )then - call ncd_defdim(lnfid, 'hist_interval', 2, hist_interval_dimid) + call ncd_defdim(lnfid, 'nbnd', 2, nbnd_dimid) call ncd_defdim(lnfid, 'time', ncd_unlimited, time_dimid) if (masterproc)then write(iulog,*) trim(subname), & @@ -880,7 +880,7 @@ subroutine htape_timeconst(t, mode) call ncd_defvar(nfid(t) , 'nstep' , ncd_int, 1, dim1id , varid, & long_name = 'time step') - dim2id(1) = hist_interval_dimid; dim2id(2) = time_dimid + dim2id(1) = nbnd_dimid; dim2id(2) = time_dimid call ncd_defvar(nfid(t), 'time_bounds', ncd_double, 2, dim2id, varid, & long_name = 'time interval endpoints', & units=str) From 8ef4d4e1e0979a31edcf21176c31fdd0302f32bc Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Tue, 11 Jul 2023 14:16:15 -0600 Subject: [PATCH 5/7] Add calendar attribute to mcdate, mcsec, mdcur, and mscur. --- src/riverroute/RtmHistFile.F90 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/riverroute/RtmHistFile.F90 b/src/riverroute/RtmHistFile.F90 index 249fa59..0da7327 100644 --- a/src/riverroute/RtmHistFile.F90 +++ b/src/riverroute/RtmHistFile.F90 @@ -871,12 +871,16 @@ subroutine htape_timeconst(t, mode) dim1id(1) = time_dimid call ncd_defvar(nfid(t) , 'mcdate', ncd_int, 1, dim1id , varid, & long_name = 'current date (YYYYMMDD)') + call ncd_putatt(nfid(t), varid, 'calendar', caldesc) call ncd_defvar(nfid(t) , 'mcsec' , ncd_int, 1, dim1id , varid, & long_name = 'current seconds of current date', units='s') + call ncd_putatt(nfid(t), varid, 'calendar', caldesc) call ncd_defvar(nfid(t) , 'mdcur' , ncd_int, 1, dim1id , varid, & long_name = 'current day (from base day)') + call ncd_putatt(nfid(t), varid, 'calendar', caldesc) call ncd_defvar(nfid(t) , 'mscur' , ncd_int, 1, dim1id , varid, & long_name = 'current seconds of current day') + call ncd_putatt(nfid(t), varid, 'calendar', caldesc) call ncd_defvar(nfid(t) , 'nstep' , ncd_int, 1, dim1id , varid, & long_name = 'time step') From 7a1a4bc6bccad307297d809565510929a5f9a0ff Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Thu, 21 Nov 2024 19:48:22 -0700 Subject: [PATCH 6/7] Correction to if-statement from #39 Adding here separately to facilitate testing. --- src/riverroute/RtmHistFile.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/riverroute/RtmHistFile.F90 b/src/riverroute/RtmHistFile.F90 index a1dd9e8..84622dd 100644 --- a/src/riverroute/RtmHistFile.F90 +++ b/src/riverroute/RtmHistFile.F90 @@ -868,7 +868,7 @@ subroutine htape_timeconst(t, mode) dim1id(1) = time_dimid str = 'days since ' // basedate // " " // basesec - if (tape(t)%hlist(1)%avgflag /= 'I') then ! NOT instantaneous fields tape + if (rtmhist_avgflag_pertape(t) /= 'I') then ! NOT instantaneous fields tape step_or_bounds = 'time_bounds' long_name = 'time at exact middle of ' // step_or_bounds call ncd_defvar(nfid(t), 'time', tape(t)%ncprec, 1, dim1id, varid, & @@ -909,7 +909,7 @@ subroutine htape_timeconst(t, mode) long_name = 'time step') dim2id(1) = nbnd_dimid; dim2id(2) = time_dimid - if (tape(t)%hlist(1)%avgflag /= 'I') then ! NOT instantaneous fields tape + if (rtmhist_avgflag_pertape(t) /= 'I') then ! NOT instantaneous fields tape call ncd_defvar(nfid(t), 'time_bounds', ncd_double, 2, dim2id, varid, & long_name = 'time interval endpoints', & units=str) @@ -945,7 +945,7 @@ subroutine htape_timeconst(t, mode) timedata(1) = tape(t)%begtime ! beginning time timedata(2) = mdcur + mscur / secspday ! end time - if (tape(t)%hlist(1)%avgflag /= 'I') then ! NOT instantaneous fields tape + if (rtmhist_avgflag_pertape(t) /= 'I') then ! NOT instantaneous fields tape time = (timedata(1) + timedata(2)) * 0.5_r8 call ncd_io('time_bounds', timedata, 'write', nfid(t), nt=tape(t)%ntimes) else From 49b4e38e17f040255f48a50f58b8f9b8db075ac2 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Tue, 14 Jan 2025 17:15:06 -0700 Subject: [PATCH 7/7] Update ChangeLog --- docs/ChangeLog.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/ChangeLog.md b/docs/ChangeLog.md index 6ebcd72..9be8a41 100644 --- a/docs/ChangeLog.md +++ b/docs/ChangeLog.md @@ -1,5 +1,22 @@
+# Tag name: rtm1_0_85 +### Originator(s): samrabin +### Date: Jan 14, 2025 +### One-line Summary: Standardize time metadata + +Standardizes a dimension name of output variable time_bounds, as well as attributes for that plus mcdate, mcsec, mdcur, and mscur. + +Contributors: Adam Phillips, Erik Kluzek + +Resolves ESCOMP/RTM#31 +Contributes to https://github.com/ESCOMP/CTSM/issues/1693 + +PR ESCOMP/RTM#35 +Contributes to https://github.com/ESCOMP/CTSM/pull/2052 + +
+ # Tag name: rtm1_0_84 ### Originator(s): ekluzek ### Date: Jan 03, 2025