ESMF_RunTestBackwards Subroutine

subroutine ESMF_RunTestBackwards(testType, YYl, MM, DD, Dl, cal)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: testType
integer(kind=ESMF_KIND_I8), intent(inout) :: YYl
integer, intent(inout) :: MM
integer, intent(inout) :: DD
integer(kind=ESMF_KIND_I8), intent(inout) :: Dl
type(ESMF_Calendar), intent(inout) :: cal

Calls

proc~~esmf_runtestbackwards~~CallsGraph proc~esmf_runtestbackwards ESMF_RunTestBackwards proc~esmf_checktime ESMF_CheckTime proc~esmf_runtestbackwards->proc~esmf_checktime proc~esmf_isleapyear ESMF_IsLeapYear proc~esmf_runtestbackwards->proc~esmf_isleapyear interface~esmf_timeset ESMF_TimeSet proc~esmf_checktime->interface~esmf_timeset proc~esmf_timeget ESMF_TimeGet proc~esmf_checktime->proc~esmf_timeget proc~esmf_timesetdefault ESMF_TimeSetDefault interface~esmf_timeset->proc~esmf_timesetdefault proc~esmf_timesetstring ESMF_TimeSetString interface~esmf_timeset->proc~esmf_timesetstring c_esmc_timeget c_esmc_timeget proc~esmf_timeget->c_esmc_timeget proc~esmf_calendarsetinitcreated ESMF_CalendarSetInitCreated proc~esmf_timeget->proc~esmf_calendarsetinitcreated proc~esmf_imerrs ESMF_IMErrS proc~esmf_timeget->proc~esmf_imerrs proc~esmf_logfounderror ESMF_LogFoundError proc~esmf_timeget->proc~esmf_logfounderror proc~esmf_timegetinit ESMF_TimeGetInit proc~esmf_timeget->proc~esmf_timegetinit proc~esmf_timeinit ESMF_TimeInit proc~esmf_timeget->proc~esmf_timeinit proc~esmf_timeintervalinit ESMF_TimeIntervalInit proc~esmf_timeget->proc~esmf_timeintervalinit proc~esmf_imerrs->proc~esmf_logfounderror proc~esmf_initcheckshallow ESMF_InitCheckShallow proc~esmf_imerrs->proc~esmf_initcheckshallow esmf_breakpoint esmf_breakpoint proc~esmf_logfounderror->esmf_breakpoint proc~esmf_logrc2msg ESMF_LogRc2Msg proc~esmf_logfounderror->proc~esmf_logrc2msg proc~esmf_logwrite ESMF_LogWrite proc~esmf_logfounderror->proc~esmf_logwrite proc~esmf_timesetdefault->proc~esmf_logfounderror proc~esmf_timesetdefault->proc~esmf_timeinit c_esmc_timeset c_esmc_timeset proc~esmf_timesetdefault->c_esmc_timeset proc~esmf_calendargetinit ESMF_CalendarGetInit proc~esmf_timesetdefault->proc~esmf_calendargetinit proc~esmf_imerr ESMF_IMErr proc~esmf_timesetdefault->proc~esmf_imerr proc~esmf_timesetstring->interface~esmf_timeset proc~esmf_timesetstring->proc~esmf_logfounderror

Source Code

      subroutine ESMF_RunTestBackwards(testType, YYl, MM, DD, Dl, cal)

! !ARGUMENTS:
      integer, intent(in) :: testType
      integer(ESMF_KIND_I8), intent(inout) :: YYl
      integer, intent(inout) :: MM
      integer, intent(inout) :: DD
      integer(ESMF_KIND_I8), intent(inout) :: Dl
      type(ESMF_Calendar), intent(inout) :: cal
        
! !DESCRIPTION:
!     Goes backwards one day at a time until the calendar conversion 
!     algorithm breaks.
!
!EOPI
      logical :: broken 

      broken = .false.
      do while (.not.broken)
    
        ! calculate what previous Julian Day number should be
        Dl = Dl - 1

        ! calculate what the previous date in given calendar should be
        DD = DD - 1
        if (DD.eq.0) then
          MM = MM - 1
          if (MM.eq.0) then
            MM = 12
            YYl = YYl - 1
          end if
          DD = DaysPerMonth(MM)
          ! check if leap year
          if (MM.eq.2) then
            if (ESMF_IsLeapYear(YYl, cal)) then
              DD = 29
            end if
          end if
        end if

        ! check calculated dates against ESMF dates
        broken = ESMF_CheckTime(testType, YYl, MM, DD, Dl, cal, rc)
      end do

      end subroutine ESMF_RunTestBackwards