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.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
character(len=*), | intent(in) | :: | timeString |
string expression of data and time |
||
integer, | intent(out) | :: | date | |||
integer, | intent(out) | :: | begTime |
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