brandon-rhodes / pyephem

Scientific-grade astronomy routines for Python
Other
781 stars 121 forks source link

Times and azimuth angles returned by Observer.next_pass do not match data from HeavesAbove #125

Closed laci37 closed 7 years ago

laci37 commented 7 years ago

While playing around with Pyephem I tried to calculate the data for this ISS pass over Budapest.

This was the code I used:

import ephem
obs = ephem.Observer()
obs.lat = 47.4979
obs.long = 19.0402
iss = ephem.readtle('ISS', '1 25544U 98067A   17259.02218116  .00016717  00000-0  10270-3 0  9035', '2 25544  51.6420 305.5126 0004198 283.5006  76.5679 15.54215637 35870')
obs.date = ephem.Date('2017/19/15 03:00:00.00')
info = obs.next_pass(iss)
print("Rise at %s, az: %s" % (info[0], info[1]))
print("Highest at %s, az: %s" % (info[2], info[3]))
print("Set at %s, az: %s" % (info[4], info[5]))

The output is:

Rise at 2018/7/18 03:48:44, az: 342:53:57.5
Highest at 2018/7/18 03:53:27, az: 13:18:55.7
Set at 2018/7/18 03:58:08, az: 104:51:53.3

The times are off by about 20 minutes. Did I mess something up, or is this a bug in pyephem? I had luck in observing the space station based on data from HeavensAbove, so I trust that they calculated that well. The TLE is from HeavensAbove too.

ghost commented 7 years ago

obs.date = ephem.Date('2017/19/15 03:00:00.00')???

Not even in the UK :)

Just to clarify my comment: the date 2017/19/15 doesn't make sense in either the US or the UK. There are only 12 months in the year. Perhaps you meant 2017/9/15?

brandon-rhodes commented 7 years ago

@laci37 — Alas! Because of a very poor design decision made long ago, PyEphem interprets angles as radians unless they are supplied as strings. Try:

obs.lat = '47.4979'
obs.long = '19.0402'

I am writing a more modern library named Skyfield that does not have hidden differences like this between strings and floats.

brandon-rhodes commented 7 years ago

Feel free to re-open this if you run into further problems!