我正在創建一個應用程序來預測衛星可見通行證。 在應用程序中,我使用'if'語句來決定衛星是否可見。pyephem next_pass函數返回不同的結果
如下;
if satellite.neverup is False and satellite.circumpolar is False:
observer.next_pass(satellite)
該計算適用於大多數LEO衛星。 但是,我發現了一些好奇的結果。在satellite.compute(observer)
之前和返回不同的值之後使用next_pass函數。
以下代碼重現結果。
import ephem
line_0 = '0 SL-3 R/B'
line_1 = '1 12904U 81103B 14252.72400340 .00001812 00000-0 13444-3 0 5754'
line_2 = '2 12904 081.1813 349.2718 0030677 147.5032 212.8569 15.02708918340741'
target = ephem.readtle(line_0,line_1,line_2)
site = ephem.Observer()
site.lon = '151:43:00'
site.lat = '-27:26:00'
site.elevation = 400
site.name = 'test facility'
site.horizon = '40:00:00'
site.date = '2014/9/20 00:29:10'
print ephem.__version__
print site.next_pass(target)
target.compute(site)
print [target.neverup,target.circumpolar]
print site.next_pass(target)
結果如下;
3.7.5.3
(2014/9/20 01:55:43, 303:49:09.6, 2014/9/20 00:25:02, 30:44:01.7, 2014/9/20 00:30:10, 164:08:09.1)
[False, False]
(None, None, None, None, None, None)
我該如何避免這種結果改變? 我錯在哪裏?
預先感謝您。
無關:如果不是x:'而不是'if x is False:' – jfs 2014-10-03 07:01:29