<p>As @PM 2Ring pointed out in the comments, there was a problem between TDB and UTC times (the difference between them is small but impacts the x,y, and z results).</p>
<p>Now, comparing the solution and the raw response, we get the same:
<a href="https://i.sstatic.net/6HWJQrCB.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/6HWJQrCB.jpg" alt="enter image description here" /></a></p>
<p>Thank you so much for your useful comments!</p>

CC BY-SA 4.0
2024-04-18T11:34:29.000Z
Happy ending, yay! You can also check the "accept" button so future readers know the problem was solved.
uhoh
CC BY-SA 4.0
2024-04-16T08:13:29.427Z
2024-04-16T08:13:29.427Z
Milagros Colazo
<p>I am attempting to obtain the x, y, z coordinates of the Sun-asteroid vector using Horizons.</p>
<p>The code I wrote is:</p>
<pre><code>jd_tdb = Time(2457171.6650230, format='jd', scale='utc').tdb.value
obj_sun = Horizons(id=21, location='500@10',
        epochs=jd_tdb, id_type='smallbody')
vec_sun = obj_sun.vectors()
</code></pre>
<p>The obtained values are:
<a href="https://i.sstatic.net/qcb1L.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/qcb1L.png" alt="enter image description here" /></a></p>
<p>However, the Horizons website and/or the 'raw_response' in Astroquery provide:</p>
<p><a href="https://i.sstatic.net/c5ynm.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/c5ynm.png" alt="enter image description here" /></a></p>
<p>So, there is a small difference (but important for astrometric purposes) between the outputs.</p>
<p><a href="https://i.sstatic.net/x9J1G.jpg" rel="nofollow noreferrer"><img src="https://i.sstatic.net/x9J1G.jpg" alt="enter image description here" /></a></p>
<p>Does anyone have insight into the issue?</p>
<p>Thank you.</p>

CC BY-SA 4.0
2024-04-15T14:24:21.117Z
I dont know Astroquery (but I do know Horizons, and Python). I think the difference is due to a time scale issue. The Horizons query is using TDB, but your original Astroquery call looks like it's using UTC.
PM 2Ring
CC BY-SA 4.0
2024-04-15T14:28:24.117Z
I think that I am converting to tdb here: Time(2457171.6650230, format='jd', scale='utc').tdb.value. So, the inputs should be the same as far as I understand.
Milagros Colazo
CC BY-SA 4.0
2024-04-15T14:40:43.673Z
Yes, but your original call uses JD 2457171.6650230 UTC, but the Horizons output is for JD 2457171.6650230 TDB.
PM 2Ring
CC BY-SA 4.0
2024-04-15T15:44:39.197Z
This does the resolution of this [astroquery issue](https://github.com/astropy/astroquery/issues/2293) help at all?
Roy Smart
CC BY-SA 4.0
2024-04-15T17:35:47.900Z
@Roy Interesting. The Horizons record for 21 Lutetia has the Solution date: 2024-Feb-23_20:13:24 https://ssd.jpl.nasa.gov/api/horizons.api?format=text&MAKE_EPHEM=NO&COMMAND=21%3B
PM 2Ring
<python><ephemeris><jpl>
Inconsistency between Horizons data retrieved via Astroquery and Horizons web interface
Milagros Colazo
# Inconsistency between Horizons data retrieved via Astroquery and Horizons web interface

(Asked by: username_0 on 2024-04-15)

I am attempting to obtain the x, y, z coordinates of the Sun-asteroid vector using Horizons.
The code I wrote is:
jd_tdb = Time(2457171.6650230, format='jd', scale='utc').tdb.value
obj_sun = Horizons(id=21, location='500@10',
        epochs=jd_tdb, id_type='smallbody')
vec_sun = obj_sun.vectors()

The obtained values are:

However, the Horizons website and/or the 'raw_response' in Astroquery provide:

So, there is a small difference (but important for astrometric purposes) between the outputs.

Does anyone have insight into the issue?
Thank you.

**Tags:** python, ephemeris, jpl
> **Comments:**
> **username_1**: I dont know Astroquery (but I do know Horizons, and Python). I think the difference is due to a time scale issue. The Horizons query is using TDB, but your original Astroquery call looks like it's using UTC.  
> **username_0**: I think that I am converting to tdb here: Time(2457171.6650230, format='jd', scale='utc').tdb.value. So, the inputs should be the same as far as I understand.  
> **username_1**: Yes, but your original call uses JD 2457171.6650230 UTC, but the Horizons output is for JD 2457171.6650230 TDB.  
> **username_2**: This does the resolution of this [astroquery issue](https://github.com/astropy/astroquery/issues/2293) help at all?  
> **username_1**: @Roy Interesting. The Horizons record for 21 Lutetia has the Solution date: 2024-Feb-23_20:13:24 https://ssd.jpl.nasa.gov/api/horizons.api?format=text&MAKE_EPHEM=NO&COMMAND=21%3B  

---

## 1 answers

### Answer by username_0 on 2024-04-16. Score: 2 | Accepted answer

As @PM 2Ring pointed out in the comments, there was a problem between TDB and UTC times (the difference between them is small but impacts the x,y, and z results).

Now, comparing the solution and the raw response, we get the same:
[![enter image description here](https://i.sstatic.net/6HWJQrCB.jpg)](https://i.sstatic.net/6HWJQrCB.jpg)

Thank you so much for your useful comments!

> **Comments:**
> **username_3**: Happy ending, yay! You can also check the "accept" button so future readers know the problem was solved.  

---

