My previous post on using PyEphem to compute satellite locations was based upon my experience with the latest version (3.7.3.4). Apparently this includes a fairly serious change to previous versions: by default my FreeBSD box seems to install 3.7.3.3 still, and the next_pass
method for observers doesn’t exist. So I thought I’d go back and use whatever calls they did, but next_rising
followed by next_setting
didn’t seem to return what I would expect. For example, this little program (first find the next rising, then, after that, return the next setting):
#!/usr/bin/env python
import sys
import os
try:
import ephem
print "Using pyephem version", ephem.__version__
except:
print "couldn't find an installed version of pyephem"
print "try downloading and installing it from http://rhodesmill.org/pyephem/"
sys.exit(1)
iss = ephem.readtle("ISS (ZARYA) ",
"1 25544U 98067A 09270.93046296 .00012316 00000-0 87133-4 0 6870",
"2 25544 51.6378 139.3506 0009010 136.5725 48.2903 15.74423743622138")
obs = ephem.city("San Francisco")
iss.compute(obs)
print "ISS is currently at alt %f az %f" % (iss.alt, iss.az)
rise = obs.next_rising(iss)
set = obs.next_setting(iss)
print rise, set
sys.exit(0)
When I run this rather simple little program, I get this:
Using pyephem version 3.7.3.3
ISS is currently at alt -1.181396 az 4.241607
Traceback (most recent call last):
File "./iss", line 22, in <module>
rise = obs.next_rising(iss)
File "/usr/local/lib/python2.5/site-packages/ephem/__init__.py", line 385, in next_rising
return self._riset_helper(body, start, True, False)
File "/usr/local/lib/python2.5/site-packages/ephem/__init__.py", line 363, in _riset_helper
d1 = visit_transit()
File "/usr/local/lib/python2.5/site-packages/ephem/__init__.py", line 317, in visit_transit
% (body.name, d))
ephem.NeverUpError: 'ISS (ZARYA)' transits below the horizon at 2009/10/2 07:44:16
I haven’t tracked down what the deal is with this yet, but maybe I should keep on with my Python Plan13 code a bit longer.