get_filename_from_template_use_index Function

public function get_filename_from_template_use_index(obsfile_start_time, obsfile_interval, f_index, file_template, exist, rc) result(filename)

Uses

  • proc~~get_filename_from_template_use_index~~UsesGraph proc~get_filename_from_template_use_index get_filename_from_template_use_index module~mapl_stringtemplate MAPL_StringTemplate proc~get_filename_from_template_use_index->module~mapl_stringtemplate module~plain_netcdf_time Plain_netCDF_Time proc~get_filename_from_template_use_index->module~plain_netcdf_time ESMF ESMF module~mapl_stringtemplate->ESMF module~mapl_exceptionhandling MAPL_ExceptionHandling module~mapl_stringtemplate->module~mapl_exceptionhandling module~mapl_keywordenforcermod MAPL_KeywordEnforcerMod module~mapl_stringtemplate->module~mapl_keywordenforcermod module~plain_netcdf_time->ESMF iso_c_binding iso_c_binding module~plain_netcdf_time->iso_c_binding iso_fortran_env iso_fortran_env module~plain_netcdf_time->iso_fortran_env module~mapl_constants MAPL_Constants module~plain_netcdf_time->module~mapl_constants module~mapl_errorhandlingmod MAPL_ErrorHandlingMod module~plain_netcdf_time->module~mapl_errorhandlingmod module~plain_netcdf_time->module~mapl_exceptionhandling module~plain_netcdf_time->module~mapl_keywordenforcermod module~mapl_shmemmod MAPL_ShmemMod module~plain_netcdf_time->module~mapl_shmemmod module~pfio_netcdf_supplement pfio_NetCDF_Supplement module~plain_netcdf_time->module~pfio_netcdf_supplement module~mapl_constants->iso_fortran_env module~mapl_internalconstantsmod MAPL_InternalConstantsMod module~mapl_constants->module~mapl_internalconstantsmod module~mapl_mathconstantsmod MAPL_MathConstantsMod module~mapl_constants->module~mapl_mathconstantsmod module~mapl_physicalconstantsmod MAPL_PhysicalConstantsMod module~mapl_constants->module~mapl_physicalconstantsmod module~mapl_throwmod MAPL_ThrowMod module~mapl_errorhandlingmod->module~mapl_throwmod mpi mpi module~mapl_errorhandlingmod->mpi module~mapl_exceptionhandling->module~mapl_errorhandlingmod module~mapl_exceptionhandling->module~mapl_throwmod module~mapl_shmem MAPL_Shmem module~mapl_shmemmod->module~mapl_shmem module~pfio_netcdf_supplement->iso_c_binding module~mapl_internalconstantsmod->iso_fortran_env module~mapl_mathconstantsmod->iso_fortran_env module~mapl_physicalconstantsmod->iso_fortran_env module~mapl_physicalconstantsmod->module~mapl_mathconstantsmod module~mapl_shmem->iso_c_binding module~mapl_shmem->iso_fortran_env module~mapl_shmem->module~mapl_constants module~mapl_shmem->mpi

Arguments

Type IntentOptional Attributes Name
type(ESMF_Time), intent(in) :: obsfile_start_time
type(ESMF_TimeInterval), intent(in) :: obsfile_interval
integer, intent(in) :: f_index
character(len=*), intent(in) :: file_template
logical, intent(out) :: exist
integer, intent(out), optional :: rc

Return Value character(len=ESMF_MAXSTR)


Calls

proc~~get_filename_from_template_use_index~~CallsGraph proc~get_filename_from_template_use_index get_filename_from_template_use_index ESMF_TimeIntervalGet ESMF_TimeIntervalGet proc~get_filename_from_template_use_index->ESMF_TimeIntervalGet ESMF_TimeIntervalSet ESMF_TimeIntervalSet proc~get_filename_from_template_use_index->ESMF_TimeIntervalSet interface~mapl_assert MAPL_Assert proc~get_filename_from_template_use_index->interface~mapl_assert proc~esmf_time_to_two_integer ESMF_time_to_two_integer proc~get_filename_from_template_use_index->proc~esmf_time_to_two_integer proc~fglob fglob proc~get_filename_from_template_use_index->proc~fglob proc~fill_grads_template fill_grads_template proc~get_filename_from_template_use_index->proc~fill_grads_template proc~mapl_return MAPL_Return proc~get_filename_from_template_use_index->proc~mapl_return proc~mapl_verify MAPL_Verify proc~get_filename_from_template_use_index->proc~mapl_verify proc~esmf_time_to_two_integer->proc~mapl_return proc~esmf_time_to_two_integer->proc~mapl_verify ESMF_TimeGet ESMF_TimeGet proc~esmf_time_to_two_integer->ESMF_TimeGet proc~fglob->interface~mapl_assert interface~f_call_c_glob f_call_c_glob proc~fglob->interface~f_call_c_glob interface~mapl_am_i_root MAPL_Am_I_Root proc~fglob->interface~mapl_am_i_root proc~fill_grads_template->interface~mapl_assert proc~fill_grads_template->proc~mapl_return proc~fill_grads_template->proc~mapl_verify ESMF_CalendarCreate ESMF_CalendarCreate proc~fill_grads_template->ESMF_CalendarCreate ESMF_CalendarDestroy ESMF_CalendarDestroy proc~fill_grads_template->ESMF_CalendarDestroy proc~fill_grads_template->ESMF_TimeGet ESMF_TimeSet ESMF_TimeSet proc~fill_grads_template->ESMF_TimeSet 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

Called by

proc~~get_filename_from_template_use_index~~CalledByGraph proc~get_filename_from_template_use_index get_filename_from_template_use_index proc~find_m_files_for_currtime Find_M_files_for_currTime proc~find_m_files_for_currtime->proc~get_filename_from_template_use_index

Source Code

  function get_filename_from_template_use_index (obsfile_start_time, obsfile_interval, &
       f_index, file_template, exist, rc) result(filename)
    use Plain_netCDF_Time, only : ESMF_time_to_two_integer
    use MAPL_StringTemplate, only : fill_grads_template
    character(len=ESMF_MAXSTR) :: filename
    type(ESMF_Time), intent(in) :: obsfile_start_time
    type(ESMF_TimeInterval), intent(in) :: obsfile_interval
    character(len=*), intent(in) :: file_template
    integer, intent(in) :: f_index
    logical, intent(out) :: exist
    integer, optional, intent(out) :: rc

    integer :: itime(2)
    integer :: nymd, nhms
    integer :: status
    real(ESMF_KIND_R8) :: dT0_s
    real(ESMF_KIND_R8) :: s
    type(ESMF_TimeInterval) :: dT
    type(ESMF_Time) :: time
    integer :: i, j, u
    logical :: allow_wild_char
    character(len=ESMF_MAXSTR) :: filename2


    call ESMF_TimeIntervalGet(obsfile_interval, s_r8=dT0_s, rc=status)
    s = dT0_s * f_index
    call ESMF_TimeIntervalSet(dT, s_r8=s, rc=status)
    time = obsfile_start_time + dT

    call ESMF_time_to_two_integer(time, itime, _RC)
    nymd = itime(1)
    nhms = itime(2)

    ! parse time info
    !
    allow_wild_char=.true.
    j= index(file_template, '*')
    _ASSERT ( j==0 .OR. allow_wild_char, "* is not allowed in template")
    call fill_grads_template ( filename, file_template, &
         experiment_id='', nymd=nymd, nhms=nhms, _RC )
    if (j==0) then
       ! exact file name
       inquire(file= trim(filename), EXIST = exist)
    else
       ! now filename is:  file*.nc
       call fglob(filename, filename2, rc=status)
       exist = (status==0)
       if (exist) filename=trim(filename2)
    end if

    _RETURN(_SUCCESS)

  end function get_filename_from_template_use_index