read_epoch Subroutine

public subroutine read_epoch(f, epoch_mode, year, month, day, hour, minute, sec, et)

Read the epoch info from a config file.

Arguments

Type IntentOptional Attributes Name
type(config_file), intent(inout) :: f
integer, intent(out) :: epoch_mode

1 : calendar date was specified, 2: ephemeris time was specified

integer, intent(out) :: year

only output if found (epoch_mode=1)

integer, intent(out) :: month

only output if found (epoch_mode=1)

integer, intent(out) :: day

only output if found (epoch_mode=1)

integer, intent(out) :: hour

only output if found (epoch_mode=1)

integer, intent(out) :: minute

only output if found (epoch_mode=1)

real(kind=wp), intent(out) :: sec

only output if found (epoch_mode=1)

real(kind=wp), intent(out) :: et

the ephemeris time [always output]


Calls

proc~~read_epoch~~CallsGraph proc~read_epoch read_epoch jd_to_et jd_to_et proc~read_epoch->jd_to_et julian_date julian_date proc~read_epoch->julian_date none~get config_file%get proc~read_epoch->none~get proc~get_char config_file%get_char none~get->proc~get_char proc~get_int config_file%get_int none~get->proc~get_int proc~get_logical config_file%get_logical none~get->proc~get_logical proc~get_real config_file%get_real none~get->proc~get_real proc~get_real_vec config_file%get_real_vec none~get->proc~get_real_vec get get proc~get_char->get proc~get_int->get proc~get_logical->get proc~get_real->get proc~get_real_vec->get

Called by

proc~~read_epoch~~CalledByGraph proc~read_epoch read_epoch proc~read_config_file my_solver_type%read_config_file proc~read_config_file->proc~read_epoch proc~initialize_the_solver my_solver_type%initialize_the_solver proc~initialize_the_solver->proc~read_config_file proc~halo_solver_main halo_solver_main proc~halo_solver_main->proc~initialize_the_solver

Source Code

    subroutine read_epoch(f, epoch_mode, year, month, day, hour, minute, sec, et)

    type(config_file),intent(inout) :: f
    integer,intent(out) :: year, month, day, hour, minute !! only output if found (epoch_mode=1)
    real(wp),intent(out) :: sec                           !! only output if found (epoch_mode=1)
    integer,intent(out) :: epoch_mode !! 1 : calendar date was specified, 2: ephemeris time was specified
    real(wp),intent(out) :: et !! the ephemeris time [always output]

    logical :: found, found_et
    logical,dimension(6) :: found_calendar

    ! can specify either calendar date or et:
    call f%get('year',   year   , found_calendar(1) )
    call f%get('month',  month  , found_calendar(2) )
    call f%get('day',    day    , found_calendar(3) )
    call f%get('hour',   hour   , found_calendar(4) )
    call f%get('minute', minute , found_calendar(5) )
    call f%get('sec',    sec    , found_calendar(6) )
    call f%get('et_ref', et     , found_et )

    found = all(found_calendar) .or. found_et ! at least one
    if (found) found = .not. (all(found_calendar) .and. found_et) ! only one
    if (.not. found) error stop 'error: just specify epoch as year,month,day,hour,minute,sec or et_ref'
    if (found_et) then
        epoch_mode = 2 ! ephemeris time was specified
    else
        epoch_mode = 1 ! calendar date was specified
    end if

    if (epoch_mode==1) then
        ! have to convert to et [see update_epoch]
        et = jd_to_et(julian_date(year,&
                                  month,&
                                  day,&
                                  hour,&
                                  minute,&
                                  sec))
    end if

    end subroutine read_epoch