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

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

<p>This uses the Python package <a href="https://rhodesmill.org/skyfield/" rel="nofollow noreferrer">Skyfield</a> 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.</p>

<p>If you would like to use NASA JPL's <a href="https://ssd.jpl.nasa.gov/horizons.cgi" rel="nofollow noreferrer">Horizons</a> web interface online, <a href="https://space.stackexchange.com/a/25357/12102">here are some instructions</a>. It uses some of the same <a href="https://en.wikipedia.org/wiki/Jet_Propulsion_Laboratory_Development_Ephemeris" rel="nofollow noreferrer">Development Ephemerides</a> that Skyfield downloads for you.</p>

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

<pre><code>                    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.
</code></pre>

<p>Here's a Python 3 script for that output as an example</p>

<pre><code>import numpy as np
import matplotlib.pyplot as plt
from skyfield.api import Topos, Loader, EarthSatellite

load    = Loader('~/Documents/fishing/SkyData')  # avoids multiple copies of large files
data    = load('de421.bsp')
ts      = load.timescale()

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])
</code></pre>

CC BY-SA 4.0
2019-10-18T08:54:10.540Z
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?
Siddharth Bhatnagar
CC BY-SA 4.0
2019-10-18T09:40:52.633Z
@SiddharthBhatnagar I'm no expert on this, there are summaries of the various ones [in Wikipedia](https://en.wikipedia.org/wiki/Jet_Propulsion_Laboratory_Development_Ephemeris#Ephemerides_in_the_series) and [at JPL](https://ssd.jpl.nasa.gov/?planet_eph_export) 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
CC BY-SA 4.0
2019-10-18T10:42:20.363Z
Makes sense, will keep that in mind. Thanks again.
Siddharth Bhatnagar
CC BY-SA 4.0
2019-10-03T07:59:50.793Z
2019-10-03T07:59:50.793Z
uhoh
<p>For a project that I am currently working on, I would like to know how one could extract velocity component values (<span class="math-container">$v_x$</span>, <span class="math-container">$v_y$</span> and <span class="math-container">$v_z$</span>) for a planet from the Stellarium software. The current information panel for a planet does show its orbital velocity (which is the resultant velocity, <span class="math-container">$v$</span>) but does not give the individual <span class="math-container">$v_x$</span>, <span class="math-container">$v_y$</span> and <span class="math-container">$v_z$</span> values that result in that velocity. </p>

<p>What I essentially need, is to establish a velocity heading for the planet.</p>

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

CC BY-SA 4.0
2019-10-02T16:37:19.253Z
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
astrosnapper
CC BY-SA 4.0
2019-10-03T07:18:03.127Z
@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
CC BY-SA 4.0
2019-10-03T07:18:09.570Z
@barrycarter ditto.
uhoh
CC BY-SA 4.0
2019-10-18T08:34:14.240Z
@barrycarter Thanks a lot for pointing me to the HORIZONS resource. Looks like this might just solve my problem!
Siddharth Bhatnagar
CC BY-SA 4.0
2019-10-18T08:35:23.937Z
@astrosnapper Many thanks to you too.
Siddharth Bhatnagar
<orbital-mechanics><orbital-elements><positional-astronomy><python>
Could someone please explain to me how I can extract velocity component values from Stellarium, for a given planet?
Siddharth Bhatnagar
# Could someone please explain to me how I can extract velocity component values from Stellarium, for a given planet?

(Asked by: username_0 on 2019-10-02)

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!

**Tags:** orbital-mechanics, orbital-elements, positional-astronomy, python

> **Comments:**
> **username_1**: 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  
> **username_2**: @username_1 *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.  
> **username_2**: @barrycarter ditto.  
> **username_0**: @barrycarter Thanks a lot for pointing me to the HORIZONS resource. Looks like this might just solve my problem!  
> **username_0**: @username_1 Many thanks to you too.  

---

## 1 answers

### Answer by username_2 on 2019-10-03. Score: 0 | Accepted answer

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](https://rhodesmill.org/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](https://ssd.jpl.nasa.gov/horizons.cgi) web interface online, [here are some instructions](https://space.stackexchange.com/a/25357/12102). It uses some of the same [Development Ephemerides](https://en.wikipedia.org/wiki/Jet_Propulsion_Laboratory_Development_Ephemeris) 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

load    = Loader('~/Documents/fishing/SkyData')  # avoids multiple copies of large files
data    = load('de421.bsp')
ts      = load.timescale()

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])

```

> **Comments:**
> **username_0**: 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?  
> **username_2**: @username_0 I'm no expert on this, there are summaries of the various ones [in Wikipedia](https://en.wikipedia.org/wiki/Jet_Propulsion_Laboratory_Development_Ephemeris#Ephemerides_in_the_series) and [at JPL](https://ssd.jpl.nasa.gov/?planet_eph_export) 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.  
> **username_0**: Makes sense, will keep that in mind. Thanks again.  

---

