time_ESMF_to_real Subroutine

public subroutine time_ESMF_to_real(times_R8_1d, times_esmf_1d, datetime_units, rc)

Uses

  • proc~~time_esmf_to_real~~UsesGraph proc~time_esmf_to_real time_ESMF_to_real module~mapl_netcdf MAPL_NetCDF proc~time_esmf_to_real->module~mapl_netcdf MAPL_DateTime_Parsing MAPL_DateTime_Parsing module~mapl_netcdf->MAPL_DateTime_Parsing module~mapl_cf_time MAPL_CF_Time module~mapl_netcdf->module~mapl_cf_time module~mapl_datetime_parsing_esmf MAPL_DateTime_Parsing_ESMF module~mapl_netcdf->module~mapl_datetime_parsing_esmf module~mapl_exceptionhandling MAPL_ExceptionHandling module~mapl_netcdf->module~mapl_exceptionhandling module~mapl_keywordenforcermod MAPL_KeywordEnforcerMod module~mapl_netcdf->module~mapl_keywordenforcermod module~mapl_cf_time->MAPL_DateTime_Parsing module~mapl_cf_time->module~mapl_exceptionhandling module~mapl_cf_time->module~mapl_keywordenforcermod iso_fortran_env iso_fortran_env module~mapl_cf_time->iso_fortran_env module~mapl_datetime_parsing_esmf->MAPL_DateTime_Parsing module~mapl_datetime_parsing_esmf->module~mapl_exceptionhandling module~mapl_datetime_parsing_esmf->module~mapl_keywordenforcermod ESMF ESMF module~mapl_datetime_parsing_esmf->ESMF module~mapl_errorhandlingmod MAPL_ErrorHandlingMod module~mapl_exceptionhandling->module~mapl_errorhandlingmod module~mapl_throwmod MAPL_ThrowMod module~mapl_exceptionhandling->module~mapl_throwmod module~mapl_errorhandlingmod->module~mapl_throwmod mpi mpi module~mapl_errorhandlingmod->mpi

Arguments

Type IntentOptional 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

Calls

proc~~time_esmf_to_real~~CallsGraph proc~time_esmf_to_real time_ESMF_to_real ESMF_TimeIntervalGet ESMF_TimeIntervalGet proc~time_esmf_to_real->ESMF_TimeIntervalGet interface~convert_netcdf_datetime_to_esmf convert_NetCDF_DateTime_to_ESMF proc~time_esmf_to_real->interface~convert_netcdf_datetime_to_esmf interface~mapl_assert MAPL_Assert proc~time_esmf_to_real->interface~mapl_assert proc~mapl_return MAPL_Return proc~time_esmf_to_real->proc~mapl_return proc~mapl_verify MAPL_Verify proc~time_esmf_to_real->proc~mapl_verify at at proc~mapl_return->at insert insert proc~mapl_return->insert proc~mapl_throw_exception MAPL_throw_exception proc~mapl_return->proc~mapl_throw_exception proc~mapl_verify->proc~mapl_throw_exception

Source Code

  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