From ac0f75e4ded4b01c886482117d2dc76c11d4fb45 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Mon, 10 Jul 2023 13:25:16 -0600 Subject: [PATCH 01/10] Rename 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 cfd190e..b03ad25 100644 --- a/src/riverroute/RtmHistFile.F90 +++ b/src/riverroute/RtmHistFile.F90 @@ -176,7 +176,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 !----------------------------------------------------------------------- @@ -748,7 +748,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), & @@ -847,7 +847,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 = 'history time interval endpoints') From 3bfc8bf0c7b49ce769c7a1893cfc3a474ea12d8f Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Mon, 10 Jul 2023 13:29:26 -0600 Subject: [PATCH 02/10] 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 b03ad25..45fe04e 100644 --- a/src/riverroute/RtmHistFile.F90 +++ b/src/riverroute/RtmHistFile.F90 @@ -849,7 +849,8 @@ subroutine htape_timeconst(t, mode) dim2id(1) = nbnd_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 = 'history 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 79f1088177e95c2d34c100afc71d2b33501ac167 Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Mon, 10 Jul 2023 13:30:19 -0600 Subject: [PATCH 03/10] 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 45fe04e..42d7d76 100644 --- a/src/riverroute/RtmHistFile.F90 +++ b/src/riverroute/RtmHistFile.F90 @@ -849,7 +849,7 @@ subroutine htape_timeconst(t, mode) dim2id(1) = nbnd_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', & units=str) dim2id(1) = strlen_dimid; dim2id(2) = time_dimid From adbdcb50addcba657de6846623ca84e29c1a8e8a Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Mon, 10 Jul 2023 13:33:18 -0600 Subject: [PATCH 04/10] 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 42d7d76..4db6545 100644 --- a/src/riverroute/RtmHistFile.F90 +++ b/src/riverroute/RtmHistFile.F90 @@ -851,6 +851,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 87f09b6a7c508500574271f2bdb8a31bf1f148fc Mon Sep 17 00:00:00 2001 From: Sam Rabin Date: Tue, 11 Jul 2023 14:15:32 -0600 Subject: [PATCH 05/10] 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 4db6545..0b982af 100644 --- a/src/riverroute/RtmHistFile.F90 +++ b/src/riverroute/RtmHistFile.F90 @@ -838,12 +838,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 858248f005a37cf5fbfde4e02fb3b40fdaaf8e28 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Tue, 19 Nov 2024 14:49:51 -0700 Subject: [PATCH 06/10] Bring this PR's mods from RtmHistFile.F90 to mosart_histfile.F90 --- src/riverroute/mosart_histfile.F90 | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/riverroute/mosart_histfile.F90 b/src/riverroute/mosart_histfile.F90 index 316a5a3..d677f9c 100644 --- a/src/riverroute/mosart_histfile.F90 +++ b/src/riverroute/mosart_histfile.F90 @@ -151,7 +151,7 @@ module mosart_histfile 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 !----------------------------------------------------------------------- @@ -697,7 +697,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 (mainproc)then write(iulog,*) trim(subname),' : Successfully defined netcdf history file ',t @@ -790,22 +790,28 @@ subroutine htape_timeconst(t, mode) long_name = 'current date (YYYYMMDD) at end of ' // step_or_bounds call ncd_defvar(nfid(t) , 'mcdate', ncd_int, 1, dim1id , varid, & long_name = long_name) + call ncd_putatt(nfid(t), varid, 'calendar', caldesc) long_name = 'current seconds of current date at end of ' // step_or_bounds call ncd_defvar(nfid(t) , 'mcsec' , ncd_int, 1, dim1id , varid, & long_name = long_name, units='s') + call ncd_putatt(nfid(t), varid, 'calendar', caldesc) long_name = 'current day (from base day) at end of ' // step_or_bounds call ncd_defvar(nfid(t) , 'mdcur' , ncd_int, 1, dim1id , varid, & long_name = long_name) + call ncd_putatt(nfid(t), varid, 'calendar', caldesc) long_name = 'current seconds of current day at end of ' // step_or_bounds call ncd_defvar(nfid(t) , 'mscur' , ncd_int, 1, dim1id , varid, & long_name = long_name) + call ncd_putatt(nfid(t), varid, 'calendar', caldesc) 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 if (tape(t)%hlist(1)%avgflag /= 'I') then ! NOT instantaneous fields tape call ncd_defvar(nfid(t), 'time_bounds', ncd_double, 2, dim2id, varid, & - long_name = 'history time interval endpoints') + long_name = 'time interval endpoints', & + units=str) + call ncd_putatt(nfid(t), varid, 'calendar', caldesc) end if dim2id(1) = strlen_dimid; dim2id(2) = time_dimid From d819640048cb0bf4e772a154c2781fe457555883 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Thu, 21 Nov 2024 19:34:44 -0700 Subject: [PATCH 07/10] Revert 692d183 and 7749459 from PR #70 for active cism test to pass Originally came in with mosart1.1.03. May be reversed in another tag along the way, but I'm adding here to proceed with successful testing in the series of "history" PRs. --- src/cpl/nuopc/rof_import_export.F90 | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/cpl/nuopc/rof_import_export.F90 b/src/cpl/nuopc/rof_import_export.F90 index 08dbc60..80cc7c7 100644 --- a/src/cpl/nuopc/rof_import_export.F90 +++ b/src/cpl/nuopc/rof_import_export.F90 @@ -113,10 +113,8 @@ subroutine advertise_fields(gcomp, flds_scalar_name, rc) call fldlist_add(fldsToRof_num, fldsToRof, 'Flrl_rofsub') call fldlist_add(fldsToRof_num, fldsToRof, 'Flrl_rofi') call fldlist_add(fldsToRof_num, fldsToRof, 'Flrl_irrig') - if ( ctl%rof_from_glc ) then - call fldlist_add(fldsToRof_num, fldsToRof, 'Fgrg_rofl') ! liq runoff from glc - call fldlist_add(fldsToRof_num, fldsToRof, 'Fgrg_rofi') ! ice runoff from glc - end if + call fldlist_add(fldsToRof_num, fldsToRof, 'Fgrg_rofl') ! liq runoff from glc + call fldlist_add(fldsToRof_num, fldsToRof, 'Fgrg_rofi') ! ice runoff from glc do n = 1,fldsToRof_num call NUOPC_Advertise(importState, standardName=fldsToRof(n)%stdname, & From bb03b174d0e7e4d355f2cd0be8865408a23157a4 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Thu, 21 Nov 2024 19:43:45 -0700 Subject: [PATCH 08/10] Correction to if-statement from #106 Adding here separately to facilitate testing. --- src/riverroute/mosart_histfile.F90 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/riverroute/mosart_histfile.F90 b/src/riverroute/mosart_histfile.F90 index d677f9c..61f96d9 100644 --- a/src/riverroute/mosart_histfile.F90 +++ b/src/riverroute/mosart_histfile.F90 @@ -766,7 +766,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 (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, & @@ -807,7 +807,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 (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) @@ -846,7 +846,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 (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 6f2327b9b6c44628be6809ee40c31ab1399a42df Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Tue, 14 Jan 2025 17:25:40 -0700 Subject: [PATCH 09/10] Draft ChangeLog --- docs/ChangeLog.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/ChangeLog.md b/docs/ChangeLog.md index 758b1c5..eeee094 100644 --- a/docs/ChangeLog.md +++ b/docs/ChangeLog.md @@ -1,3 +1,23 @@ +
+# Tag name: mosart1.1.08 +### 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 + +Fixes ESCOMP/MOSART#53 +Contributes to https://github.com/ESCOMP/CTSM/issues/1693 + +Testing: standard testing (ekluzek) + izumi ---- + derecho -- + +See https://github.com/ESCOMP/MOSART/pull/66 for more details +Contributes to https://github.com/ESCOMP/CTSM/pull/2052 +
# Tag name: mosart1.1.07 ### Originator(s): erik From c023afe1a1c060ef1d9f7d61256d849c69aca815 Mon Sep 17 00:00:00 2001 From: Samuel Levis Date: Tue, 14 Jan 2025 18:46:38 -0700 Subject: [PATCH 10/10] Update ChangeLog --- docs/ChangeLog.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/ChangeLog.md b/docs/ChangeLog.md index eeee094..d0ff439 100644 --- a/docs/ChangeLog.md +++ b/docs/ChangeLog.md @@ -12,8 +12,8 @@ Fixes ESCOMP/MOSART#53 Contributes to https://github.com/ESCOMP/CTSM/issues/1693 Testing: standard testing (ekluzek) - izumi ---- - derecho -- + izumi ---- OK + derecho -- OK See https://github.com/ESCOMP/MOSART/pull/66 for more details Contributes to https://github.com/ESCOMP/CTSM/pull/2052