Interface for the ephemeris_module.
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(jpl_ephemeris), | intent(inout) | :: | me | |||
real(kind=fat_wp), | intent(in) | :: | et |
ephemeris time [sec] |
||
type(celestial_body), | intent(in) | :: | targ |
target body |
||
type(celestial_body), | intent(in) | :: | obs |
observer body |
||
real(kind=fat_wp), | intent(out), | dimension(6) | :: | rv |
state of targ w.r.t. obs [km,km/s] in ICRF frame |
|
logical, | intent(out) | :: | status_ok |
true if there were no problems |
subroutine get_rv_from_jpl_ephemeris(me,et,targ,obs,rv,status_ok) use time_module, only: et_to_jd use conversion_module, only: day2sec use celestial_body_module, only: celestial_body use numbers_module, only: zero implicit none class(jpl_ephemeris),intent(inout) :: me real(fat_wp),intent(in) :: et !! ephemeris time [sec] type(celestial_body),intent(in) :: targ !! target body type(celestial_body),intent(in) :: obs !! observer body real(fat_wp),dimension(6),intent(out) :: rv !! state of targ w.r.t. obs [km,km/s] in ICRF frame logical,intent(out) :: status_ok !! true if there were no problems real(wp) :: jd !! julian date for input to [[get_state]]. integer :: ntarg !! id code for target body integer :: ncent !! id code for observer body real(wp),dimension(6) :: rv_ !! in case `wp /= fat_wp` we need a copy if (targ==obs) then !don't bother if target and observer are the same body rv = zero status_ok = .true. else !convert to expected inputs: jd = et_to_jd(et) ntarg = spice_id_to_old_id(targ%id) ncent = spice_id_to_old_id(obs%id) if (ntarg>0 .and. ncent>0) then call me%get_state(jd,ntarg,ncent,rv_,status_ok) rv = rv_ if (status_ok) then if (.not. me%km) then !we must return in units of km/s !so, convert from AU, AU/day to km, km/s rv = rv * me%au rv(4:6) = rv(4:6) / day2sec end if else write(error_unit,'(A)') 'Error in get_rv_from_jpl_ephemeris: '//& 'Error calling ephemeris.' end if else write(error_unit,'(A)') 'Error in get_rv_from_jpl_ephemeris: '//& 'No ephemeris for this body.' status_ok = .false. end if end if end subroutine get_rv_from_jpl_ephemeris