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®ion=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