<p>Looking at the numbers and comparing to <a href="https://ssd.jpl.nasa.gov/horizons.cgi" rel="nofollow noreferrer">JPL Horizons</a>, the best match is to the position of the Earth-Moon Barycenter in heliocentric coordinates. That's of course consistent with the data being labeled as:  <code>EMB, Ecliptic Heliocentric Coordinates</code>.</p>

<p>If you can live with some small uncertainties due to the details of how coordinate transforms may evolve over time, <em>I believe</em> you can just apply some simple trigonometry. You can confirm <a href="https://en.wikipedia.org/wiki/Ecliptic_coordinate_system#Rectangular_coordinates" rel="nofollow noreferrer">here</a>.</p>

<p>$$r = \sqrt{x^2 + y^2 + z^2}$$</p>

<p>$$l = tan^{-1}(y/x)$$</p>

<p>$$b = sin^{-1}(z/r)$$</p>

<hr>

<p><a href="https://i.sstatic.net/QGGmq.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/QGGmq.png" alt="enter image description here"></a></p>

<pre><code>Data in Question: for JD 2415021.0
position (AU):     [-0.2054467990,  0.9615310525,  0.0002141233]
velocity (AU/day): [-0.0171063024, -0.0036576954, -0.0000011815]

JPL Horizions Earth-Moon barycenter J2000 Heliocentric for JD 2415021.0
position (AU):     [-0.2054465857,  0.9615310983,  0.00021393097] 
velocity (AU/day): [-0.0171063032, -0.0036576916, -0.00000118253]

JPL Horizions Earth J2000 Heliocentric for JD 2415021.0
position (AU):     [-0.2054522688,  0.9615603123,  0.00021303115] 
velocity (AU/day): [-0.0171136285, -0.0036594066, -0.00000182603]

JPL Horizions Earth J2000 Solar System barycenter for JD 2415021.0
position (AU):     [-0.2022720210,  0.9679285296,  0.00010939456]
velocity (AU/day): [-0.0171209826, -0.0036556277, -0.00000165111]
</code></pre>

CC BY-SA 3.0
2017-07-24T19:01:33.267Z
I see you've been asking python questions about VSOP2013 in SO. You might want to look at the two Python packages [PyEphem](http://rhodesmill.org/pyephem/) based on VSOP87 according to [this answer](https://stackoverflow.com/a/34487339/3904031) and also definitely check out [Skyfield](http://rhodesmill.org/skyfield/). Skyfield uses the same [Development Ephemerides](https://en.wikipedia.org/wiki/Jet_Propulsion_Laboratory_Development_Ephemeris) as [Horizons](https://ssd.jpl.nasa.gov/horizons.cgi) but is very new, modern, and easy to use.
uhoh
CC BY-SA 3.0
2017-07-24T17:55:35.923Z
2017-07-24T18:03:29.427Z
2017-07-24T18:03:29.427Z
uhoh
<p>I ran <a href="https://www.aanda.org/articles/aa/abs/2013/09/aa21843-13/aa21843-13.html" rel="nofollow noreferrer">VSOP2013</a> in Fortran, and I now have the following position $x, y, z$ as well as velocity $v_x, v_y, v_z$ data.</p>

<p>How do I convert the position to <a href="https://en.wikipedia.org/wiki/Ecliptic_coordinate_system#Spherical_coordinates" rel="nofollow noreferrer">heliocentric ecliptic spherical coordinates</a> $l, b, r$? </p>

<pre><code>PLANETARY EPHEMERIS VSOP2013  EMB     
Ecliptic   Heliocentric Coordinates:  X,Y,Z (au)  X',Y',Z' (au/d)  - Dynamical Frame J2000

Julian Day 2415021.0   
-0.2054467990    0.9615310525    0.0002141233   -0.0171063024   -0.0036576954   -0.0000011815
</code></pre>

CC BY-SA 3.0
2017-07-23T19:21:13.273Z
whats L, B, R?  I have never heard of those coordinates. At least none by that name or TLA.
Natsfan
CC BY-SA 3.0
2017-07-23T21:19:54.080Z
l, b,r are heliocentric solar coordinates. l is longitude (measured from vernal equinox) b is ecliptic latiude (north positive) r is heliocentric distance. https://en.wikipedia.org/wiki/Ecliptic_coordinate_system
James K
CC BY-SA 3.0
2017-07-23T23:35:31.110Z
thanks, that sure sounds like spherical coordinates to me. lol
Natsfan
CC BY-SA 3.0
2017-07-23T23:42:18.807Z
x,y,z - do you know if they are earth rotating coordinates or just earth centered non-rotating?
Natsfan
CC BY-SA 3.0
2017-07-24T14:28:38.600Z
@barrycarter correct!
Muhamad NW
CC BY-SA 3.0
2017-07-27T07:13:41.413Z
thank you @barrycarter i thought it was different from the basic math
Muhamad NW
<the-sun><algorithm>
How to convert VSOP's xyz coordinates to heliocentric spherical lbr coordinates?
Muhamad NW
# How to convert VSOP's xyz coordinates to heliocentric spherical lbr coordinates?

(Asked by: username_0 on 2017-07-23)

I ran [VSOP2013](https://www.aanda.org/articles/aa/abs/2013/09/aa21843-13/aa21843-13.html) in Fortran, and I now have the following position $x, y, z$ as well as velocity $v\_x, v\_y, v\_z$ data.

How do I convert the position to [heliocentric ecliptic spherical coordinates](https://en.wikipedia.org/wiki/Ecliptic_coordinate_system#Spherical_coordinates) $l, b, r$?

```
PLANETARY EPHEMERIS VSOP2013  EMB     
Ecliptic   Heliocentric Coordinates:  X,Y,Z (au)  X',Y',Z' (au/d)  - Dynamical Frame J2000

Julian Day 2415021.0   
-0.2054467990    0.9615310525    0.0002141233   -0.0171063024   -0.0036576954   -0.0000011815

```

**Tags:** the-sun, algorithm

> **Comments:**
> **username_1**: whats L, B, R?  I have never heard of those coordinates. At least none by that name or TLA.  
> **username_2**: l, b,r are heliocentric solar coordinates. l is longitude (measured from vernal equinox) b is ecliptic latiude (north positive) r is heliocentric distance. https://en.wikipedia.org/wiki/Ecliptic_coordinate_system  
> **username_1**: thanks, that sure sounds like spherical coordinates to me. lol  
> **username_1**: x,y,z - do you know if they are earth rotating coordinates or just earth centered non-rotating?  
> **username_0**: @barrycarter correct!  
> **username_0**: thank you @barrycarter i thought it was different from the basic math  

---

## 1 answers

### Answer by username_3 on 2017-07-24. Score: 1 | Accepted answer

Looking at the numbers and comparing to [JPL Horizons](https://ssd.jpl.nasa.gov/horizons.cgi), the best match is to the position of the Earth-Moon Barycenter in heliocentric coordinates. That's of course consistent with the data being labeled as: `EMB, Ecliptic Heliocentric Coordinates`.

If you can live with some small uncertainties due to the details of how coordinate transforms may evolve over time, *I believe* you can just apply some simple trigonometry. You can confirm [here](https://en.wikipedia.org/wiki/Ecliptic_coordinate_system#Rectangular_coordinates).

$$r = \sqrt{x^2 + y^2 + z^2}$$

$$l = tan^{-1}(y/x)$$

$$b = sin^{-1}(z/r)$$

---

[![enter image description here](https://i.sstatic.net/QGGmq.png)](https://i.sstatic.net/QGGmq.png)

```
Data in Question: for JD 2415021.0
position (AU):     [-0.2054467990,  0.9615310525,  0.0002141233]
velocity (AU/day): [-0.0171063024, -0.0036576954, -0.0000011815]

JPL Horizions Earth-Moon barycenter J2000 Heliocentric for JD 2415021.0
position (AU):     [-0.2054465857,  0.9615310983,  0.00021393097] 
velocity (AU/day): [-0.0171063032, -0.0036576916, -0.00000118253]

JPL Horizions Earth J2000 Heliocentric for JD 2415021.0
position (AU):     [-0.2054522688,  0.9615603123,  0.00021303115] 
velocity (AU/day): [-0.0171136285, -0.0036594066, -0.00000182603]

JPL Horizions Earth J2000 Solar System barycenter for JD 2415021.0
position (AU):     [-0.2022720210,  0.9679285296,  0.00010939456]
velocity (AU/day): [-0.0171209826, -0.0036556277, -0.00000165111]

```

> **Comments:**
> **username_3**: I see you've been asking python questions about VSOP2013 in SO. You might want to look at the two Python packages [PyEphem](http://rhodesmill.org/pyephem/) based on VSOP87 according to [this answer](https://stackoverflow.com/a/34487339/3904031) and also definitely check out [Skyfield](http://rhodesmill.org/skyfield/). Skyfield uses the same [Development Ephemerides](https://en.wikipedia.org/wiki/Jet_Propulsion_Laboratory_Development_Ephemeris) as [Horizons](https://ssd.jpl.nasa.gov/horizons.cgi) but is very new, modern, and easy to use.  

---

