I am trying to use NASA's Horizons systems to create a tracker for planets but I am running into a problem related to the returned ephemeris data, particularly with the altitude and azimuth. When comparing the values of a planet like Mars from Horizons to other star maps like theskylive I get values that are incredibly different.

Planet: Mars 

Lat/Long: [43.0000N, 79.0000W]

Date: 24/07/23 21:00 pm EST

Horizons Az&Alt: [223.53, 48.51]

theskylive Az&alt: [268.8, 14.6]

Am i doing something wrong?

  • $\begingroup$ I think your input to Horizons may have had some error (see my answer) Can you show a screenshot or your input data? $\endgroup$
    – uhoh
    Commented Jul 24, 2023 at 23:19
  • $\begingroup$ Can reproduce OP's HORIZONS result with inputs of -79°E 43°N, 2023-07-24 21:40 UT. $\endgroup$
    – Mike G
    Commented Jul 25, 2023 at 1:05
  • 3
    $\begingroup$ For future reference: on the Horizons Web Application, just above the "Generate Ephemeris" button, it says "the batch-file corresponding to the settings above can be viewed by using this link." You can paste that batch file data into your question, inside a code block. That will show us exactly what data you submitted to Horizons. FWIW, I have Python code to fetch Horizons data using batch file data here: gist.github.com/PM2Ring/b1fec75e78cc08f6fc28c6f6c43529c3 $\endgroup$
    – PM 2Ring
    Commented Jul 25, 2023 at 8:13

1 Answer 1


Am i doing something wrong?

Yes I think so, probably some input to Horizons was incorrect.

  • EST or Eastern Standard Time is UTC-04, so the time "24/07/23 21:00 pm EST" is 2023-07-25 01:00:00
  • Lat/Long: [43.0000N, 79.0000W] is lat/lon = (43.0, -79.0)

Put these into Skyfield and I get alt: 15.736 az: 268.206

Since Skyfield uses essentially the same type of JPL ephemeris as Horizons, and Horizons is considered by many to be the "gold standard" since it is used by so many astronomers and space exploration professionals, I assume you must have entered some data incorrectly.

However, we won't know how or what until you at least post a screen shot of your entered data.

If I set it up like this:

JPL Horizons input setup

I get an azimuth of 268.206 and altitude of 15.736 which agrees with Skyfield.

 Date__(UT)__HR:MN     R.A._____(ICRF)_____DEC  Azi____(a-app)___Elev    APmag   S-brt             delta      deldot     S-O-T /r     S-T-O  Sky_motion  Sky_mot_PA  RelVel-ANG  Lun_Sky_Brt  sky_SNR
 2023-Jul-24 01:00 Cm  10 40 04.17 +09 29 47.4  268.205789  15.735799    1.694   4.403  2.33907874798369   8.8764023   37.3941 /T   21.9361   1.5409375   112.93846   11.511078         n.a.     n.a.
 2023-Jul-25 01:00 Cm  10 42 22.58 +09 15 25.1  268.303009  15.275338    1.691   4.396  2.34398745433334   8.7759797   37.0564 /T   21.7632   1.5426111   113.01694   11.348959         n.a.     n.a.

Here's the Skyfield script I used:

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

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

earth, mars = [eph[x] for x in ('earth', 'mars')]

topo = Topos(latitude_degrees = 43.0000,
                  longitude_degrees = -79.0000)

time = ts.utc(2023, 7, 24, 1)  # Date: 24/07/23 21:00 pm EST

mars_astrometric = (earth + topo).at(time).observe(mars)

alt, az, d = mars_astrometric.apparent().altaz()

print('alt: ', round(alt.degrees, 3), ' az: ', round(az.degrees, 3))
  • 3
    $\begingroup$ Ah it appears I didn't realize the timings were in UTC and not EST, Im also getting the right values now Thanks $\endgroup$ Commented Jul 25, 2023 at 1:37
  • $\begingroup$ @warherolion that's great! Thanks for the feedback :-) $\endgroup$
    – uhoh
    Commented Jul 25, 2023 at 8:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .