Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=ESMF_KIND_R8), | intent(inout) | :: | times_R8_1d(:) | |||
type(ESMF_Time), | intent(in) | :: | times_esmf_1d(:) | |||
character(len=*), | intent(in) | :: | datetime_units | |||
integer, | intent(out), | optional | :: | rc |
subroutine time_ESMF_to_real (times_R8_1d, times_esmf_1d, datetime_units, rc) use MAPL_NetCDF, only : convert_NetCDF_DateTime_to_ESMF type(ESMF_Time), intent(in) :: times_esmf_1d(:) real(kind=ESMF_KIND_R8), intent(inout) :: times_R8_1d(:) character(len=*), intent(in) :: datetime_units integer, optional, intent(out) :: rc type(ESMF_TimeInterval) :: interval, t_interval type(ESMF_Time) :: time0 type(ESMF_Time) :: time1 character(len=:), allocatable :: tunit integer :: i, len integer :: int_time integer :: status len = size (times_esmf_1d) int_time = 0 call convert_NetCDF_DateTime_to_ESMF(int_time, datetime_units, interval, & time0, time=time1, time_unit=tunit, _RC) do i=1, len t_interval = times_esmf_1d(i) - time0 select case(trim(tunit)) case ('days') call ESMF_TimeIntervalGet(t_interval,d_r8=times_R8_1d(i),_RC) case ('hours') call ESMF_TimeIntervalGet(t_interval,h_r8=times_R8_1d(i),_RC) case ('minutes') call ESMF_TimeIntervalGet(t_interval,m_r8=times_R8_1d(i),_RC) case ('seconds') call ESMF_TimeIntervalGet(t_interval,s_r8=times_R8_1d(i),_RC) case default _FAIL('illegal value for tunit: '//trim(tunit)) end select enddo _RETURN(_SUCCESS) end subroutine time_ESMF_to_real