From bca7d5417085f4314ee0c14284853baf5b5a0da3 Mon Sep 17 00:00:00 2001 From: Matthew Thompson Date: Sat, 5 Feb 2022 08:51:49 -0500 Subject: [PATCH] Fix bug in TimeMethods --- CHANGELOG.md | 6 ++++++ CMakeLists.txt | 2 +- base/MAPL_TimeMethods.F90 | 17 +++++++++-------- 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3545b5595c1..f9abcb831f6d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed ### Fixed +## [2.8.0.3] - 2022-02-05 + +### Fixed + +- Fixed bug `MAPL_TimeMethods::define_time_variable` where metadata was set before Variable initialized + ## [2.8.0.2] - 2022-01-19 ### Changed diff --git a/CMakeLists.txt b/CMakeLists.txt index 1d040e3a087b..781feca0f6cd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ cmake_policy (SET CMP0054 NEW) project ( MAPL - VERSION 2.8.0.2 + VERSION 2.8.0.3 LANGUAGES Fortran CXX C) # Note - CXX is required for ESMF # mepo can now clone subrepos in three styles diff --git a/base/MAPL_TimeMethods.F90 b/base/MAPL_TimeMethods.F90 index 0f2575087ab2..be72b572345a 100644 --- a/base/MAPL_TimeMethods.F90 +++ b/base/MAPL_TimeMethods.F90 @@ -86,8 +86,9 @@ function define_time_variable(this,rc) result(v) integer :: status character(len=ESMF_MAXSTR) :: startTime,timeUnits type(ESMF_Time) :: currTime - integer :: i1,i2,i3,i123,ipos1,ipos2,isc,imn,ihr,ifreq + integer :: i1,i2,i3,i123,ipos1,ipos2,isc,imn,ihr,time_increment logical :: integer_time + integer :: begin_date, begin_time call ESMF_CLockGet(this%clock,currTime=currTime,rc=status) _VERIFY(status) @@ -100,16 +101,14 @@ function define_time_variable(this,rc) result(v) read(startTime(1:ipos1-1),'(i4)')i1 read(startTime(ipos1+1:ipos2-1),'(i2)')i2 read(startTime(ipos2+1:10),'(i2)')i3 - i123=10000*i1+100*i2+i3 - call v%add_attribute('begin_date',i123) + begin_date=10000*i1+100*i2+i3 ipos1=index(startTime,":") ipos2=index(startTime,":",back=.true.) read(startTime(12:ipos1-1),'(i2)')i1 read(startTime(ipos1+1:ipos2-1),'(i2)')i2 read(startTime(ipos2+1:19),'(i2)')i3 - i123=10000*i1+100*i2+i3 - call v%add_attribute('begin_time',i123) + begin_time=10000*i1+100*i2+i3 select case(trim(this%funits)) case('minutes') @@ -120,14 +119,13 @@ function define_time_variable(this,rc) result(v) imn=mod(i2,60) i2=i2-imn ihr=i2/60 - ifreq=10000*ihr+100*imn+isc + time_increment=10000*ihr+100*imn+isc case('days') - ifreq = this%frequency/86400 + time_increment = this%frequency/86400 integer_time = mod(this%frequency,86400) == 0 case default _ASSERT(.false., 'Not supported yet') end select - call v%add_attribute('time_increment',ifreq) call this%tvec%clear() this%tcount=0 @@ -141,6 +139,9 @@ function define_time_variable(this,rc) result(v) end if call v%add_attribute('long_name','time') call v%add_attribute('units',trim(timeUnits)) + call v%add_attribute('begin_date',begin_date) + call v%add_attribute('begin_time',begin_time) + call v%add_attribute('time_increment',time_increment) _RETURN(ESMF_SUCCESS)