get_horizons_coord

sunpy.coordinates.ephemeris.get_horizons_coord(body, time='now', id_type='majorbody', *, include_velocity=False)[source]

Queries JPL HORIZONS and returns a SkyCoord for the location of a solar-system body at a specified time. This location is the instantaneous or “true” location, and is not corrected for light travel time or observer motion.

Note

This function requires the Astroquery package to be installed and requires an Internet connection.

Parameters
Keyword Arguments

include_velocity (bool) – If True, include the body’s velocity in the output coordinate. Defaults to False.

Returns

SkyCoord – Location of the solar-system body

Notes

Be aware that there can be discrepancies between the coordinates returned by JPL HORIZONS, the coordinates reported in mission data files, and the coordinates returned by get_body_heliographic_stonyhurst.

References

Examples

>>> from sunpy.coordinates.ephemeris import get_horizons_coord

Query the location of Venus

>>> get_horizons_coord('Venus barycenter', '2001-02-03 04:05:06')  
INFO: Obtained JPL HORIZONS location for Venus Barycenter (2) [sunpy.coordinates.ephemeris]
<SkyCoord (HeliographicStonyhurst: obstime=2001-02-03T04:05:06.000): (lon, lat, radius) in (deg, deg, AU)
    (-33.93155836, -1.64998443, 0.71915147)>

Query the location of the SDO spacecraft

>>> get_horizons_coord('SDO', '2011-11-11 11:11:11')  
INFO: Obtained JPL HORIZONS location for Solar Dynamics Observatory (spac [sunpy.coordinates.ephemeris]
<SkyCoord (HeliographicStonyhurst: obstime=2011-11-11T11:11:11.000): (lon, lat, radius) in (deg, deg, AU)
    (0.01019118, 3.29640728, 0.99011042)>

Query the location of the SOHO spacecraft via its ID number (-21)

>>> get_horizons_coord(-21, '2004-05-06 11:22:33', 'id')  
INFO: Obtained JPL HORIZONS location for SOHO (spacecraft) (-21) [sunpy.coordinates.ephemeris]
<SkyCoord (HeliographicStonyhurst: obstime=2004-05-06T11:22:33.000): (lon, lat, radius) in (deg, deg, AU)
    (0.25234902, -3.55863633, 0.99923086)>

Query the location and velocity of the asteroid Juno

>>> get_horizons_coord('Juno', '1995-07-18 07:17', 'smallbody', include_velocity=True)  
INFO: Obtained JPL HORIZONS location for 3 Juno [sunpy.coordinates.ephemeris]
<SkyCoord (HeliographicStonyhurst: obstime=1995-07-18T07:17:00.000): (lon, lat, radius) in (deg, deg, AU)
    (-25.16107572, 14.59098456, 3.17667662)
 (d_lon, d_lat, d_radius) in (arcsec / s, arcsec / s, km / s)
    (-0.00514936, -0.00205857, 8.89781348)>