Installed pyephem on macbook air via pip:
pip show pyephem
---
Name: pyephem
Version: 3.7.5.3
Location: /usr/local/lib/python2.7/site-packages
Requires:
The key problem I have is that the iss example found from http://rhodesmill.org/pyephem/tutorial shows:
iss = ephem.readtle("ISS (ZARYA)",
... "1 25544U 98067A 03097.78853147 .00021906 00000-0 28403-3 0 8652",
... "2 25544 51.6361 13.7980 0004256 35.6671 59.2566 15.58778559250029")
gatech.date = '2003/3/23'
iss.compute(gatech)
print("%s %s %s" % (iss.rise_time, iss.transit_time, iss.set_time))
2003/3/23 00:00:50 2003/3/23 00:03:26 2003/3/23 00:06:01
But for my code to +1 minute in a loop to get Az/El, I get 'none' or clearly incorrect results:
obs = ephem.Observer()
obs.lat = '50.045995'
obs.lon = '-5.177628'
obs.pressure = 0
obs.temp = 0
obs.date = '2015/6/8 19:43:24'
line1 = "ISS (ZARYA)"
line2 = "1 25544U 98067A 03097.78853147 .00021906 00000-0 28403-3 0 8652"
line3 = "2 25544 51.6361 13.7980 0004256 35.6671 59.2566 15.58778559250029"
iss = ephem.readtle(line1, line2, line3)
print("%f %f %f %f" % (iss._epoch,iss._n,iss._inc,iss._raan) ) # Check tle is read
while True:
#mars.compute(obs)
#print("Date/time: %s Mars Az/El %.6f %.6f" % (obs.date, float(mars.az), float(mars.alt)))
iss.compute(obs)
print("Date/time: %s ISS Az/El %.6f %.6f %.6f" % (obs.date, ephem.degree * iss.az, ephem.degree * float(iss.alt), iss.range))
print("%s %s %s" % (iss.rise_time, iss.transit_time, iss.set_time))
obs.date += ephem.minute * 1
time.sleep(1)
The result being:
Date/time: 2015/6/8 19:50:24 ISS Az/El 0.054831 -0.027391 6377154.500000
None None None
Date/time: 2015/6/8 19:51:24 ISS Az/El 0.054831 -0.027391 6377154.500000
None None None
Date/time: 2015/6/8 19:52:24 ISS Az/El 0.054831 -0.027391 6377154.500000
None None None
Date/time: 2015/6/8 19:53:24 ISS Az/El 0.054831 -0.027391 6377154.500000
None None None
I'm thinking that these errors are date/angle/obs related - but I would still expect to see them move. I've already checked converting to rads/degree in various datatypes but can't see where the error is. Any suggestions on what I'm doing wrong here when the planetary bodies all appear to work fine would be very much appreciated!
Best, Chris
Update 1 - The following change in obs doesn't work:
obs.lat = float(math.radians(50.045995))
obs.lon = float(math.radians(-5.177628))
Earth satellite elements are only accurate for a few days before and after the date for which they are issued. The elements in the documentation are from 2003, and so PyEphem cannot use them to predict where the satellite will be in 2015.
You will need to download, or cut and paste, fresh elements from NORAD:
https://celestrak.org/NORAD/elements/