strToInt Subroutine

public subroutine strToInt(timeString, date, begTime)

strToInt - convert timeString to integer date and time

This function attempts to identify a coordiante variable from the name or units of the variable. It does so by attempting to match the units specified in the COARDS conventions or by checking the name against commonly used names.

History

  • 2004.10.04 B. Yin first version.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: timeString

string expression of data and time

integer, intent(out) :: date
integer, intent(out) :: begTime

Called by

proc~~strtoint~~CalledByGraph proc~strtoint strToInt proc~esmf_cfioset ESMF_CFIOSet proc~esmf_cfioset->proc~strtoint proc~mapl_cfiowritebundlewrite MAPL_CFIOWriteBundleWrite proc~mapl_cfiowritebundlewrite->proc~strtoint proc~mapl_getcurrentfile MAPL_GetCurrentFile proc~mapl_getcurrentfile->proc~strtoint none~find~4 CFIOCollection%find none~find~4->proc~esmf_cfioset proc~esmf_cfiofileopen ESMF_CFIOFileOpen none~find~4->proc~esmf_cfiofileopen proc~esmf_cfiofilecreate ESMF_CFIOFileCreate proc~esmf_cfiofilecreate->proc~esmf_cfioset proc~esmf_cfiosdffilecreate ESMF_CFIOSdfFileCreate proc~esmf_cfiofilecreate->proc~esmf_cfiosdffilecreate proc~esmf_cfiofileopen->proc~esmf_cfioset proc~esmf_cfiosdffilecreate->proc~esmf_cfioset proc~mapl_cfiocreatewrite MAPL_CFIOCreatewrite proc~mapl_cfiocreatewrite->proc~esmf_cfioset proc~mapl_cfiocreatewrite->proc~esmf_cfiofilecreate program~test~10 test program~test~10->proc~esmf_cfioset program~test~10->proc~esmf_cfiofilecreate program~test~11 test program~test~11->proc~esmf_cfioset program~test~11->proc~esmf_cfiofilecreate program~test~11->proc~esmf_cfiofileopen program~test~12 test program~test~12->proc~esmf_cfioset program~test~12->proc~esmf_cfiofilecreate program~test~13 test program~test~13->proc~esmf_cfioset program~test~13->proc~esmf_cfiofilecreate program~test~14 test program~test~14->proc~esmf_cfioset program~test~14->proc~esmf_cfiofilecreate program~test~2 test program~test~2->proc~esmf_cfioset program~test~2->proc~esmf_cfiofileopen program~test~4 test program~test~4->proc~esmf_cfioset program~test~4->proc~esmf_cfiofileopen program~test~5 test program~test~5->proc~esmf_cfioset program~test~5->proc~esmf_cfiofilecreate program~test~6 test program~test~6->proc~esmf_cfioset program~test~6->proc~esmf_cfiofileopen program~test~7 test program~test~7->proc~esmf_cfioset program~test~7->proc~esmf_cfiofilecreate program~test~8 test program~test~8->proc~esmf_cfioset program~test~8->proc~esmf_cfiofilecreate program~test~9 test program~test~9->proc~esmf_cfioset program~test~9->proc~esmf_cfiofilecreate proc~mapl_cfiocreatefromfile MAPL_CFIOCreateFromFile proc~mapl_cfiocreatefromfile->none~find~4 proc~mapl_cfioopenwrite MAPL_CFIOOpenWrite proc~mapl_cfioopenwrite->proc~esmf_cfiofileopen proc~mapl_cfioreadbundleread MAPL_CFIOReadBundleRead proc~mapl_cfioreadbundleread->none~find~4 program~test~3 test program~test~3->proc~esmf_cfiofilecreate

Source Code

        subroutine strToInt(timeString, date, begTime)
!
! !USES:
!
      Implicit NONE
!
! !INPUT PARAMETERS:
!
      character(len=*), intent(in) :: timeString !! string expression of data and time
!
! !OUTPUT PARAMETERS:
!
      integer, intent(out) :: date
      integer, intent(out) :: begTime
!
!-------------------------------------------------------------------------
       integer :: iCnt, jCnt, dLen
       character(len=MVARLEN) :: sDate, sTime
       character(len=MVARLEN) :: strDate, strTime
       character :: char

       dLen = index(timeString, 'T' )
       sDate = timeString(1:dLen-1)
       sTime = timeString(dLen+1:len(trim(timeString)))
       jCnt = 1
       strDate = ''
       do iCnt = 1, len(sDate)
          char = sDate(iCnt:iCnt)
          if (char .ne. ':' .and. char .ne. '-') then
             strDate(jCnt:jCnt) = char
             jCnt = jCnt + 1
          end if
       end do
       jCnt = 1
       strTime = ''
       do iCnt = 1, len(sTime)
          char = sTime(iCnt:iCnt)
          if (char .ne. ':' .and. char .ne. '-') then
             strTime(jCnt:jCnt) = char
             jCnt = jCnt + 1
          end if
       end do
       read(strDate,*) date
       read(strTime,*) begTime
       return
     end subroutine strToInt