4

I am using pyEphem to get the next over pass of the ISS from my location, but the results I get back do not match what I see on heavens-above using the same coordinates

I am probably making a stupid mistake but I can't figure it out

My code below returns the results: Rise time: 2017/5/25 20:34:39 azimuth: 193:28:04.0

While the nearest heavens above pass is nearly 3 hours away, with a rise time of: 23:09:40

http://www.heavens-above.com/passdetails.aspx?&satid=25544&mjd=57898.9270155034&type=V

from datetime import datetime
import ephem
import pytz

line1 = 'ISS (ZARYA)'      
line2 = '1 25544U 98067A   17145.52800275  .00016717  00000-0  10270-3 0  9015'
line3 = '2 25544  51.6372 151.2656 0005033 192.5139 167.5889 15.53913304 18224'

tle = [line1, line2, line3]
iss = ephem.readtle(tle[0], tle[1], tle[2])

longitude = -6.2282
latitude = 53.2842
altitude = 20

site = ephem.Observer()
site.lat = str(latitude)
site.lon = str(longitude)
site.elevation = 20

current_time = datetime(2017, 5, 25, 12, 0, 0, tzinfo=pytz.utc)
site.date = current_time

info = site.next_pass(iss)
print("Rise time: %s azimuth: %s" % (info[0], info[1]))
kujosHeist
  • 810
  • 1
  • 11
  • 25
  • To make it possible for other folks to run this code, you should remove the `utcnow()` call and instead specify an exact date and time. Otherwise, someone running the script will always see a different answer than the result you shared in your answer, because they will run it on a different date than you did. – Brandon Rhodes May 25 '17 at 04:01

1 Answers1

2

Updated answer following edit of question:

Alas, Heavens Above now gives a server error when I follow the link in your question. So I visited the site afresh, entered the coordinates from your script, and got some predictions. To avoid losing them, here is a quick screenshot:

enter image description here

When I paste in a fresh TLE for the ISS into your script and adjust the current_time, I can get an answer that is pretty close to theirs. The script then looks like:

from datetime import datetime
import ephem
import pytz

line1, line2, line3 = """\
ISS (ZARYA)             
1 25544U 98067A   17198.89938657  .00000988  00000-0  22167-4 0  9998
2 25544  51.6416 245.2318 0005849  47.2823 302.7554 15.54170925 66526
""".splitlines()

tle = [line1, line2, line3]
iss = ephem.readtle(tle[0], tle[1], tle[2])

longitude = -6.2282
latitude = 53.2842
altitude = 20

site = ephem.Observer()
site.lat = str(latitude)
site.lon = str(longitude)
site.elevation = 20

current_time = datetime(2017, 7, 21, 1, 0, 0, tzinfo=pytz.utc)
site.date = current_time

info = site.next_pass(iss)
for item in info:
    print(item)

And the output is:

2017/7/21 01:32:01
263:02:11.2
2017/7/21 01:37:29
66:12:31.4
2017/7/21 01:42:58
93:15:48.0

Which is the same pass as you can see in the screenshot, expressed in Universal Time instead of the UTC+1 time zone for Dublin that Heavens Above uses — so the highest point time of 1:37am given by PyEphem becomes 2:37am in the local time zone of Dublin.

I checked another pass or two, and they all seem to agree fairly closely — could the time zone have been the source of confusion?

Original answer:

You are specifying a longitude of 53.2842° east and a latitude of 6.2282° south, which on a world map appears to be somewhere at the western edge of the Indian Ocean. Did you instead perhaps intend the negative number -53.2842°, which would put the location in Brazil instead?

Brandon Rhodes
  • 83,755
  • 16
  • 106
  • 147
  • Sorry I'm an idiot, it was meant to be latitude: 53.2842°, longitude: -6.2282, which puts me in Dublin, Ireland. When I change it I get the result: Rise time: 2015/11/14 02:07:40 azimuth: 157:24:58.0, which is still an hour away from heavens above's closed pass (visible and non visible) of 14 Nov - 03:43:02 10° SSW 03:45:18 18° SSE 03:47:38 10° E visible, I Will update the question, including the TLE – kujosHeist Nov 13 '15 at 14:37