【问题标题】:pyephem next_pass function returns different resultpyephem next_pass 函数返回不同的结果
【发布时间】:2014-09-22 12:41:17
【问题描述】:

我正在创建一个应用来预测卫星可见通道。 在应用程序中,我使用“if”语句来决定卫星是否可见。

如下;

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)

如何避免这种结果发生变化? 我哪里错了?

提前谢谢你。

【问题讨论】:

  • 不相关:使用if not x: 而不是if x is False:

标签: python pyephem


【解决方案1】:

在玩了一段时间并使用了其他 TLE 之后,我的一个想法是,neverup 没有正确考虑你的视野。也许它正在使用 00:00:00 来定义布尔值;如果您将地平线更改为 30:00:00,则输出变为:

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]
(2014/9/20 12:06:25, 191:15:15.1, 2014/9/20 12:08:23, 82:43:37.8, 2014/9/20 12:10:20, 1:10:09.6)

为了进一步调试,我们可以在此处显示的下一次通过时打印卫星的高度。即

info = site.next_pass(target)
site.date = info[0]
target.compute(site)
print target.alt

这给出了:

31:07:31.3

现在,如果我们将高度更改为 34:00:00 之类的值,我们将返回您的 None 列表。

我的猜测是,neverup 没有考虑你定义的视野,但 next_pass 是。

【讨论】:

  • 非常感谢!我将修改代码以正确确定可见性。只需添加 info[0] is not None 之类的内容似乎对我的应用程序很好。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-12-27
  • 1970-01-01
  • 2012-12-27
  • 2020-07-04
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多