# Could someone please explain to me how I can extract velocity component values from Stellarium, for a given planet?

For a project that I am currently working on, I would like to know how one could extract velocity component values ($$v_x$$, $$v_y$$ and $$v_z$$) for a planet from the Stellarium software. The current information panel for a planet does show its orbital velocity (which is the resultant velocity, $$v$$) but does not give the individual $$v_x$$, $$v_y$$ and $$v_z$$ values that result in that velocity.

What I essentially need, is to establish a velocity heading for the planet.

Any help (code-based/mathematical) would be much appreciated! Thanks in advance!

• Stellarium really isn't the right tool here. Consider HORIZONS: ssd.jpl.nasa.gov/horizons.cgi#top or the list at astronomy.stackexchange.com/questions/13488
– user21
Oct 2 '19 at 13:52
• Second @barrycarter's suggestion of HORIZONS. It has a 'Vector Table' output option that allows generation of a Cartesian state (x,y,z, velocity in x,y,z) vector table of any object with respect to any major body. It is queryable through Python via the astroquery.jplhorizons module Oct 2 '19 at 16:37
• @astrosnapper is it certain that this is not possible with Stellarium? These are excellent suggestions but sometimes people do need to use the tools they have at hand for the moment.
– uhoh
Oct 3 '19 at 7:18
• @barrycarter ditto.
– uhoh
Oct 3 '19 at 7:18
• @uhoh I didn't say it couldn't be done with Stellarium. Stellarium obviously has to calculate these individual velocities to display them. However, Stellarium's primary goal is displaying things nicely. Getting it to do something it wasn't designed for seems difficult, at the very least. If you go to F2 the configuration window and choose information, you can click "all available", which shows you a lot more info on planets, but I still don't think it gives you what you want.
– user21
Oct 3 '19 at 14:31

To follow up on the helpful comments below your question, here's a program that will do what you need, but without using Stellarium.

If you really need to use Stellarium then hopefully someone will find a way to help you.

This uses the Python package Skyfield and you can see a lot of documentation on that site and elsewhere. Right now I've specified the DE421 ephemeris, but there are many to choose from. This one only works +/- 100 or 200 years I think, others go for thousands of years in the past or future.

If you would like to use NASA JPL's Horizons web interface online, here are some instructions. It uses some of the same Development Ephemerides that Skyfield downloads for you.

Here's some output for roughly 2019-10-02 07:18:59 UTC which is the moment when you posted your question.

                    relative to solar system barycenter
x            y           z            vx        vy          vz
Sun        -453731.5    1039601.2    451057.1     -0.015      -0.002       0.0
Earth     1.4764e+08   2.1455e+07   9.3005e+06    -4.9362     26.9295     11.6751
Jupiter  -2.2857e+07  -7.2214e+08  -3.0898e+08    12.9012      0.3382     -0.1690
Mumbai    1.4763e+08   2.1454e+07   9.3025e+06    -4.8369     26.5009     11.6749

relative to Earth's geocenter

Sun      -1.4809e+08  -2.0416e+07  -8.8494e+06     4.9215    -26.9312    -11.6754
Earth     0.           0.           0.             0.          0.          0.
Jupiter  -1.7050e+08  -7.4360e+08  -3.1828e+08    17.8374    -26.5912    -11.844
Mumbai   -5873.8303   -1362.2932     2072.3226  9.9338e-02    -4.2861e-01 -1.9206e-04

relative to Mumbai

Sun      -1.4809e+08  -2.0414e+07  -8.8515e+06     4.8222    -26.5026    -11.6752
Earth       5873.83     1362.29     -2072.32      -9.9338e-02  4.2861e-01  1.9206e-04
Jupiter  -1.7049e+08  -7.4359e+08  -3.1828e+08    17.7381    -26.1626    -11.8439
Mumbai    0.           0.           0.             0.          0.          0.


Here's a Python 3 script for that output as an example

import numpy as np
import matplotlib.pyplot as plt
from skyfield.api import Topos, Loader, EarthSatellite

sun     = data['sun']
earth   = data['earth']
jupiter = data['jupiter barycenter']
mumbai  = earth + Topos(latitude_degrees  = 18.98,
longitude_degrees = 72.83,
elevation_m       =  20.0)
time    = ts.utc(2019, 10, 2, 7, 18, 59)

things     = (sun, earth, jupiter, mumbai)
names      = ('Sun', 'Earth', 'Jupiter', 'Mumbai')
positions  = [thing.at(time).position.km for thing in things]
velocities = [thing.at(time).velocity.km_per_s for thing in things]

for name, position, velocity in zip(names, positions, velocities):
print(name, position, velocity)

print("relative to Earth's Geocenter")
for name, position, velocity in zip(names, positions, velocities):
print(name, position-positions[1], velocity-velocities[1])

print("relative to Mumbai")
for name, position, velocity in zip(names, positions, velocities):
print(name, position-positions[3], velocity-velocities[3])

• Thanks so much for sharing the python code and for the HORIZONS and DE links! Also, DE421, the ephehermis you've recommended, covers the years 1900 to 2200. It so happens that for my project, the period of time that I'm interested in is between 1781 and 1881, for Uranus. What DE do you think would be most appropriate for this? DE414? Oct 18 '19 at 8:54
• @SiddharthBhatnagar I'm no expert on this, there are summaries of the various ones in Wikipedia and at JPL for example DE405 covers 1600 to 2200 (60 MB) and DE406 covers 3000 BC to AD 3000 (290 MB). It takes a while to download the big ones but I don't think it affects the speed while you are running. Make sure to use load = Loader('pathname') so that you can run from any folder without it downloading a new (huge) file in each folder.
– uhoh
Oct 18 '19 at 9:40
• Makes sense, will keep that in mind. Thanks again. Oct 18 '19 at 10:42