;+ ; NAME: ; jpl_body ; PURPOSE: ; Used to set the 'body' and 'center' input to the main JPL Lunar ; and planetary ephemeris routine jpl_eph ; CATEGORY: ; smei/gen/idl/ephem, JPL Lunar and Planetary ephemeris ; CALLING SEQUENCE: FUNCTION jpl_body, number , $ sun = sun , $ mercury = mercury , $ venus = venus , $ earth = earth , $ mars = mars , $ jupiter = jupiter , $ saturn = saturn , $ uranus = uranus , $ neptune = neptune , $ pluto = pluto , $ moon = moon , $ ssbary = ssbary , $ embary = embary , $ nutations=nutations , $ librations=librations,$ count = count , $ string = string ; OPTIONAL INPUT PARAMETERS: ; Only one of the following keywords should be set. If none is set then ; a list of all names is returned. ; ; /sun ; /mercury ; /venus ; /earth ; /mars ; /jupiter ; /saturn ; /uranus ; /neptune ; /pluto ; /moon selects the corresponding body ; ; /ssbary selects the solar system barycenter ; /embary selects the Earth-Moon barycenter ; ; /nutations selects /nutations (may not be present in ephemeris file?) ; /librations selects /librations (may not be present in ephemeris file?) ; OUTPUTS: ; Result scalar; type: integer ; integer value corresponding to selected location ; OPTIONAL OUTPUTS: ; count=count scalar; type: integer ; number of bodies in JPL ephem (Sun, planets and Moon) ; These take the first 'count' position in the array ; returned by jpl_body() ; INCLUDE: @compile_opt.pro ; On error, return to caller ; CALLS: ; IsType, where_common ; SEE ALSO: ; jpl_eph ; PROCEDURE: ; The numbering convention is: ; 0 = Sun 8 = Neptune ; 1 = Mercury 9 = Pluto ; 2 = Venus 10 = Moon ; 3 = Earth 13 = Solar-system barycenter ; 4 = Mars 14 = Earth-Moon barycenter ; 5 = Jupiter 11 = Nutations (longitude and obliquity) ; 6 = Saturn 12 = Librations (if on file) ; 7 = Uranus ; ; A call to jpl_eph will typically contain two calls to jpl_body, e.g. ; P = jpl_eph( UT, jpl_body(/earth), center=jpl_body(/sun)) ; returns heliocentric position and velocity coordinates for Earth. ; MODIFICATION HISTORY: ; DEC-2002, Paul Hick (UCSD/CASS) ; OCT-2006, Paul Hick (UCSD/CASS; pphick@ucsd.edu) ; Added keyword /string ;- ; SS-bary = Solar system barycenter ; EM-bary = Earth-Moon system barycenter names = ['Sun','Mercury','Venus','Earth','Mars','Jupiter','Saturn','Uranus','Neptune', $ 'Pluto','Moon','SS-bary','EM-bary'] InitVar, string, /key count = 11 ; # bodies: sun, 9 planets, moon CASE 1 OF IsType(number, /generic_int): body = names[number] IsType(number, /string ): BEGIN body = replicate(-1,n_elements(number)) tmp = where_common(strlowcase(number), strlowcase(names), inref=inref) IF tmp[0] NE -1 THEN body[tmp] = inref IF IsType(number,/scalar) THEN body = body[0] END keyword_set(sun ): IF string THEN body = jpl_body( 0) ELSE body = 0 keyword_set(mercury ): IF string THEN body = jpl_body( 1) ELSE body = 1 keyword_set(venus ): IF string THEN body = jpl_body( 2) ELSE body = 2 keyword_set(earth ): IF string THEN body = jpl_body( 3) ELSE body = 3 keyword_set(mars ): IF string THEN body = jpl_body( 4) ELSE body = 4 keyword_set(jupiter ): IF string THEN body = jpl_body( 5) ELSE body = 5 keyword_set(saturn ): IF string THEN body = jpl_body( 6) ELSE body = 6 keyword_set(uranus ): IF string THEN body = jpl_body( 7) ELSE body = 7 keyword_set(neptune ): IF string THEN body = jpl_body( 8) ELSE body = 8 keyword_set(pluto ): IF string THEN body = jpl_body( 9) ELSE body = 9 keyword_set(moon ): IF string THEN body = jpl_body(10) ELSE body = 10 keyword_set(ssbary ): IF string THEN body = jpl_body(13) ELSE body = 13 keyword_set(embary ): IF string THEN body = jpl_body(14) ELSE body = 14 keyword_set(nutations ): IF string THEN body = jpl_body(11) ELSE body = 11 keyword_set(librations ): IF string THEN body = jpl_body(12) ELSE body = 12 ELSE : body = names ENDCASE RETURN, body & END