Skip to content

Planets

Low-precision planetary ephemerides for the eight major planets.

For higher accuracy, use the jplephem module which provides full JPL ephemeris data.

planets

Low-precision planetary ephemerides from https://ssd.jpl.nasa.gov/?planet_pos

heliocentric_pos(body, tm)

Return the position of the given body in the Heliocentric coordinate system (origin is the Sun)

Note: This function is only valid for the Sun and the 8 planets

Note: This is less accurate than using the jpl ephemeris, but involves fewer calculations

Note: See https://ssd.jpl.nasa.gov/?planet_pos for more information and accuracy details

Parameters:

Name Type Description Default
body solarsystem

Solar system body for which to return position

required
tm time | ndarray | list

Time[s] at which to return position

required

Returns:

Type Description
NDArray[float64]

numpy.ndarray: 3-vector of Cartesian position in meters, with the origin at the Sun. If input is list or numpy array of N times, then r will be Nx3 array

Example
import numpy as np
t = satkit.time(2024, 1, 1)
pos = satkit.planets.heliocentric_pos(satkit.solarsystem.Mars, t)
print(f"Mars distance from Sun: {np.linalg.norm(pos)/satkit.consts.au:.2f} AU")