3

I have been reading previous posts here but I still have a question. I am just making a very simple script to tell me when satellites are passing over my city.

I am using this blog post as a guide: http://libjoe.blogspot.com.au/2009/10/where-is-my-satellite-in-python.html

For testing, I am checking whether the output for the ISS station matches the predicted output on the nasa site but it doesn't match: http://spotthestation.nasa.gov/sightings/view.cfm?country=Australia&region=Victoria&city=Melbourne#.VLr7I82UdhE

I have my lat&long set for Melbourne, and I am using ephem.localtime when printing out the rise & set times. However, the times never match the nasa site.

Any advice would be greatly appreciated, thank you!

import datetime
import ephem
import math
import os
import sys 
import time
import urllib2

observer = ephem.Observer()
observer.long = '-37.799423'
observer.lat = '144.999979'
observer.date = datetime.datetime.now()

tles = urllib2.urlopen('http://www.amsat.org/amsat/ftp/keps/current/nasabare.txt').readlines()
tles = [item.strip() for item in tles]
tles = [(tles[i],tles[i+1],tles[i+2]) for i in xrange(0,len(tles)-2,3)]

for tle in tles:

   try:
     sat = ephem.readtle(tle[0], tle[1], tle[2])
     rt, ra, tt, ta, st, sa = observer.next_pass(sat)

     if rt is not None and st is not None:
       #observer.date = rt
       sat.compute(observer)

       print tle[0]
       print 'rise time: ', ephem.localtime(rt)
       print 'set time: ',  ephem.localtime(st)
       print
   except ValueError as e:
    print e

Here is the output of my script run now at "15:10" in Melbourne on 18th Jan 2015, where the ISS station is listed in the output as:

rise time: 2015-01-19 02:27:09
set time: 2015-01-19 02:37:37

However, the NASA site (spotthestation.nasa.gov/sightings/…) states the following predictions for Jan 19th:

  • Mon Jan 19, 9:23 PM and
  • Mon Jan 19, 10:59 PM
Brandon Rhodes
  • 83,755
  • 16
  • 106
  • 147
Paul P
  • 31
  • 1
  • To make the question more concrete, could you specify a particular time returned for you from the NASA site, and then the not-matching result you get from PyEphem? That will make it easier for people to investigate, because they will know that they are reproducing your exact situation. Thanks! – Brandon Rhodes Jan 18 '15 at 01:24
  • Good Idea! Here is the output of my script run now at "15:10" in Melbourne on 18th Jan 2015, where the ISS station is listed in the output as: rise time: 2015-01-19 02:27:09 set time: 2015-01-19 02:37:37 However, the NASA site (http://spotthestation.nasa.gov/sightings/view.cfm?country=Australia&region=Victoria&city=Melbourne#.VLszAc2UdhE) states the following predictions for Jan 19th: Mon Jan 19, 9:23 PM and Mon Jan 19, 10:59 PM – Paul P Jan 18 '15 at 04:14
  • Thank you, Paul! I hope you won't mind that I have pressed “Edit” and edited your question to include this crucial information so that everyone sees it. I should get some time later today to look at this output and see if I can figure anything out, if no one else has answered first. – Brandon Rhodes Jan 19 '15 at 20:17
  • Did you ever found the source of the problem? I'm experiencing the same issue. – user45237841 Mar 07 '18 at 16:05

2 Answers2

2

Typically, longitude is a “big number” between ±180° while latitude is a small number in the more limited range ±90° — is it possible that you have reversed the latitude and longitude here?

Brandon Rhodes
  • 83,755
  • 16
  • 106
  • 147
  • Hi, I'm looking for the same answer, do you know the answer about this? I just have the information of today (TLE information's) – mikesneider Feb 16 '17 at 14:44
0

For people who end up here with the same problem. This is what resolved mine:

  1. Read the documentation. Especially related to the timezones. Keep in mind that the default setting is UTC time and may be different than yours

  2. Library is optimistic on the sighting predictions, therefore it may deviate from JSatTrak and online resources. In my case, library predicted a sighting for a pass fairly close to the observer, but yet on the boundary of the visibility. JSatTrak and online resources ignored it. To see if that's the case in your sitauation, set the observer time at the end-time of the original prediction + 1 minute. The next pass will likely be the same as the online prediction. (I have a feeling that it might be related to the observer elevation, but I didn't do my homework on the source code or the calculations.)