<p>Read the fine print under the Horizons output when you select an OBSERVER table. It says (emphasis mine)</p>

<blockquote>
  <p>R.A._(ICRF/J2000.0)_DEC =<br>
     J2000.0 astrometric right ascension and declination of target center.
  <strong>Adjusted for light-time.</strong> Units: HMS (HH MM SS.ff) and DMS (DD MM SS.f)</p>
</blockquote>

<p>You could do the same, but it will take some extra work. The Mars you see at some time $t$ was emitted from Mars several minutes earlier than that. You need to find the $\Delta t$ such that the distance between Mars at time $t-\Delta t$ and Earth at time $t$ is equal to the speed of light times $\Delta t$. One correction will get you very close, a second will get you even closer.</p>

<p>Another issue is time. JPL uses its own time scale, JPL ephemeris time (T<sub>eph</sub>). This is a relativistic time scale. It differs from Terrestrial Time (TT) by at most a few milliseconds, so for most purposes you can use TT in lieu of T<sub>eph</sub> in your homebrew ephemeris calculator. TT currently differs from UTC by 67.184 seconds, and beginning in July (there's a leap second at the end of June), it will differ from UTC by 68.184 seconds.</p>

<p><br></p>

<p>Or you could just live with it. If you are using your calculations for your backyard telescope, the handful of arc seconds of error that results from not accounting for the finite speed of light is small.</p>

CC BY-SA 3.0
2017-04-17T22:19:13.763Z
After the leap second on 2017-01-01, TT - UTC = 69.184
nealmcb
CC BY-SA 3.0
2015-04-22T10:55:24.327Z
Thanks a lot for the answer! I assumed as much but got lost in the fine-print :) This helps me because I wasn't sure if I was starting from invalid assumptions, hence didn't know where to start. I'll take a stab at the light-time adjustment, just need to get my head around it.
Nenad Vukicevic
CC BY-SA 3.0
2015-04-22T12:27:54.037Z
A follow up: Following the advice from the answer, using Terrestrial Time,  two corrections for light-time adjustment and calculating RA/Dec for Earth@T and Mars@T-Δt I get the exact result as Horizons! Beautiful. Thanks again David!
Nenad Vukicevic
CC BY-SA 3.0
2015-04-22T13:04:33.333Z
@NenadVukicevic - You're welcome. BTW, it's not the exact same results as Horizons. It looks like Horizons switched from using DE405 to DE431 about a year ago. DE405 is an outdated product from some previous millennium (1998, to be exact). It's about time they made that switch. The impact on backyard astronomy is negligible. The impact on spacecraft -- that's not so negligible.
David Hammen
CC BY-SA 3.0
2015-04-21T23:57:19.177Z
2015-04-22T00:20:11.943Z
2015-04-22T00:20:11.943Z
David Hammen
<p>I'm using <a href="ftp://ssd.jpl.nasa.gov/pub/eph/planets/" rel="noreferrer">JPL planetary ephemerides</a> to calculate the position of planets. Using DE405 ephemeris (using a parser provided by Project Pluto with all tests passing). I am fetching the position of Mars with the observer set as the Earth (geocentric).</p>

<p>My first assumption is that the result is a set of geocentric equatorial coordinates in rectangular form (x, y, z). This may be incorrect.</p>

<p>My goal is to calculate RA/Dec. My second assumption is that I should use a formula converting from Cartesian to Spherical:</p>

<p>$r =\sqrt(x^2+y^2+z^2)$
$ra =\arctan(y/x)$
$dec = \pi/2 - arccos(z/r)$</p>

<p>Using Julian day 2457134 (21st Apr 2015, noon UTC), and cross-checking the result with NASA's <a href="http://ssd.jpl.nasa.gov/horizons.cgi" rel="noreferrer">Horizons</a> service which apparently uses the same ephemeris (DE405) gets me almost there but my results are a little off:</p>

<p><strong>x</strong> 1.721427968227801 <strong>y</strong> 1.5802812301744067 <strong>z</strong> 0.6897426775298559</p>

<p><strong>RA</strong> 02h50m12.51s <strong>Dec</strong> +16°26'41.37"</p>

<p>Horizons:</p>

<p><strong>RA</strong> 02h50m11.52s <strong>Dec</strong> +16°26'36.5"</p>

<p>I'm not sure what I'm missing. Do I have to factor distance of the planet due to the time it takes for light to reach us? Am I not using the correct time? Are my assumptions wrong?</p>

<planet><coordinate>
Calculating RA/dec from JPL ephemeris data
Nenad Vukicevic
# Calculating RA/dec from JPL ephemeris data

(Asked by: username_0 on 2015-04-21)

I'm using [JPL planetary ephemerides](ftp://ssd.jpl.nasa.gov/pub/eph/planets/) to calculate the position of planets. Using DE405 ephemeris (using a parser provided by Project Pluto with all tests passing). I am fetching the position of Mars with the observer set as the Earth (geocentric).

My first assumption is that the result is a set of geocentric equatorial coordinates in rectangular form (x, y, z). This may be incorrect.

My goal is to calculate RA/Dec. My second assumption is that I should use a formula converting from Cartesian to Spherical:

$r =\sqrt(x^2+y^2+z^2)$
$ra =\arctan(y/x)$
$dec = \pi/2 - arccos(z/r)$

Using Julian day 2457134 (21st Apr 2015, noon UTC), and cross-checking the result with NASA's [Horizons](http://ssd.jpl.nasa.gov/horizons.cgi) service which apparently uses the same ephemeris (DE405) gets me almost there but my results are a little off:

**x** 1.721427968227801 **y** 1.5802812301744067 **z** 0.6897426775298559

**RA** 02h50m12.51s **Dec** +16°26'41.37"

Horizons:

**RA** 02h50m11.52s **Dec** +16°26'36.5"

I'm not sure what I'm missing. Do I have to factor distance of the planet due to the time it takes for light to reach us? Am I not using the correct time? Are my assumptions wrong?

**Tags:** planet, coordinate


---

## 1 answers

### Answer by username_1 on 2015-04-21. Score: 6 | Accepted answer

Read the fine print under the Horizons output when you select an OBSERVER table. It says (emphasis mine)

> R.A.\_(ICRF/J2000.0)\_DEC =  
> J2000.0 astrometric right ascension and declination of target center.
> **Adjusted for light-time.** Units: HMS (HH MM SS.ff) and DMS (DD MM SS.f)

You could do the same, but it will take some extra work. The Mars you see at some time $t$ was emitted from Mars several minutes earlier than that. You need to find the $\Delta t$ such that the distance between Mars at time $t-\Delta t$ and Earth at time $t$ is equal to the speed of light times $\Delta t$. One correction will get you very close, a second will get you even closer.

Another issue is time. JPL uses its own time scale, JPL ephemeris time (Teph). This is a relativistic time scale. It differs from Terrestrial Time (TT) by at most a few milliseconds, so for most purposes you can use TT in lieu of Teph in your homebrew ephemeris calculator. TT currently differs from UTC by 67.184 seconds, and beginning in July (there's a leap second at the end of June), it will differ from UTC by 68.184 seconds.

Or you could just live with it. If you are using your calculations for your backyard telescope, the handful of arc seconds of error that results from not accounting for the finite speed of light is small.

> **Comments:**
> **username_0**: Thanks a lot for the answer! I assumed as much but got lost in the fine-print :) This helps me because I wasn't sure if I was starting from invalid assumptions, hence didn't know where to start. I'll take a stab at the light-time adjustment, just need to get my head around it.  
> **username_0**: A follow up: Following the advice from the answer, using Terrestrial Time,  two corrections for light-time adjustment and calculating RA/Dec for Earth@T and Mars@T-Δt I get the exact result as Horizons! Beautiful. Thanks again username_1!  
> **username_1**: @username_0 - You're welcome. BTW, it's not the exact same results as Horizons. It looks like Horizons switched from using DE405 to DE431 about a year ago. DE405 is an outdated product from some previous millennium (1998, to be exact). It's about time they made that switch. The impact on backyard astronomy is negligible. The impact on spacecraft -- that's not so negligible.  
> **username_2**: After the leap second on 2017-01-01, TT - UTC = 69.184  

---

