spice_id_to_standish_id Function

private pure function spice_id_to_standish_id(spice_id) result(old_id)

Convert the NAIF SPICE ID code to the one used by the standish ephemeris. Returns 0 if the body was not found.

See also

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: spice_id

the ID code used by SPICE

Return Value integer

the ID code used by this module


Called by

proc~~spice_id_to_standish_id~~CalledByGraph proc~spice_id_to_standish_id standish_module::spice_id_to_standish_id proc~standish_rv_func standish_module::standish_ephemeris%standish_rv_func proc~standish_rv_func->proc~spice_id_to_standish_id proc~standish_module_test standish_module::standish_module_test proc~standish_module_test->proc~standish_rv_func

Source Code

    pure function spice_id_to_standish_id(spice_id) result(old_id)

    implicit none

    integer,intent(in) :: spice_id !! the ID code used by SPICE
    integer            :: old_id   !! the ID code used by this module

    integer :: i !! counter

    !>
    !  The index of this array is the ID code. The value is the NAIF code.
    !  See: [NAIF Integer ID codes](http://naif.jpl.nasa.gov/pub/naif/toolkit_docs/FORTRAN/req/naif_ids.html)
    integer,parameter,dimension(9) :: new_ids = &
        [   199,&  ! mercury
            299,&  ! venus
            3,  &  ! earth-moon barycenter
            499,&  ! mars
            599,&  ! jupiter
            699,&  ! saturn
            799,&  ! uranus
            899,&  ! neptune
            999]   ! pluto

    !just a simple search of the list:
    ! [small enough that bisection search probably not worth it]
    do i=1,size(new_ids)
        if (new_ids(i)==spice_id) then
            old_id = i
            return
        end if
    end do

    !not found:
    old_id = 0

    end function spice_id_to_standish_id