get_format_statement Subroutine

private subroutine get_format_statement(str, fmt)

Returns the format statement from a line in a .GEO gravity coefficient file.

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: str
character(len=*), intent(out) :: fmt

Called by

proc~~get_format_statement~~CalledByGraph proc~get_format_statement geopotential_module::get_format_statement proc~read_geopotential_file geopotential_module::geopotential_model%read_geopotential_file proc~read_geopotential_file->proc~get_format_statement proc~geopotential_module_test geopotential_module::geopotential_module_test proc~geopotential_module_test->proc~read_geopotential_file

Source Code

    subroutine get_format_statement(str,fmt)

    implicit none

    character(len=*),intent(in)  :: str
    character(len=*),intent(out) :: fmt

    integer :: i1,i2

    !note: other text after the format statement is ignored

    i1 = index(str,'(')
    i2 = index(str,')')

    if (i1/=0 .and. i2/=0 .and. i2>i1) then
        fmt = str(i1:i2)
    else
        write(*,*) 'ERROR: THE STRING DOES NOT CONTAIN A FORMAT STATEMENT: '//trim(str)
        fmt = ''
    end if

    end subroutine get_format_statement