我很难弄清楚如何计算卫星穿越特定经度的时间。能够提供时间段和TLE并能够在特定时间段内返回卫星跨越给定经度的所有时间将是很好的。 pyephem支持这样的事情吗?使用pyephem计算卫星何时穿越经度
5
A
回答
5
用户可能会问很多可能的情况 - 当卫星穿越特定的经度;当它达到特定的纬度时;当它达到一定高度或下降到最低高度时;当它的速度最大或最小时 - PyEphem不会尝试为它们提供内置函数。相反,它提供了一个newton()
函数,它可以让您找到想要在卫星属性与要搜索的该属性的预定值之间进行任何比较的过零点。
注意,SciPy的Python库包含的远远超过PyEphem的newton()
功能更复杂一些非常谨慎的搜索功能,如果你正在处理一个特别差的乖功能:
http://docs.scipy.org/doc/scipy/reference/optimize.html
这里当一颗卫星 - 在这个例子中是国际空间站 - 通过一个特定的经度时,你将如何搜索,以显示一般技术。这不是最快的方法 - 特别是如果我们非常小心的话,逐分搜索可以加快速度 - 但它被写为非常一般和非常安全,以防除经度之外还有其他值你也想搜索。我试图添加文档和评论来解释发生了什么,以及为什么我使用znorm
而不是返回简单的区别。让我知道这个脚本是否适合你,并且足够清楚地解释它的方法!
import ephem
line0 = 'ISS (ZARYA) '
line1 = '1 25544U 98067A 13110.27262069 .00008419 00000-0 14271-3 0 6447'
line2 = '2 25544 51.6474 35.7007 0010356 160.4171 304.1803 15.52381363825715'
sat = ephem.readtle(line0, line1, line2)
target_long = ephem.degrees('-83.8889')
def longitude_difference(t):
'''Return how far the satellite is from the target longitude.
Note carefully that this function does not simply return the
difference of the two longitudes, since that would produce a
terrible jagged discontinuity from 2pi to 0 when the satellite
crosses from -180 to 180 degrees longitude, which could happen to be
a point close to the target longitude. So after computing the
difference in the two angles we run degrees.znorm on it, so that the
result is smooth around the point of zero difference, and the
discontinuity sits as far away from the target position as possible.
'''
sat.compute(t)
return ephem.degrees(sat.sublong - target_long).znorm
t = ephem.date('2013/4/20')
# How did I know to make jumps by minute here? I experimented: a
# `print` statement in the loop showing the difference showed huge jumps
# when looping by a day or hour at a time, but minute-by-minute results
# were small enough steps to bring the satellite gradually closer to the
# target longitude at a rate slow enough that we could stop near it.
#
# The direction that the ISS travels makes the longitude difference
# increase with time; `print` statements at one-minute increments show a
# series like this:
#
# -25:16:40.9
# -19:47:17.3
# -14:03:34.0
# -8:09:21.0
# -2:09:27.0
# 3:50:44.9
# 9:45:50.0
# 15:30:54.7
#
# So the first `while` loop detects if we are in the rising, positive
# region of this negative-positive pattern and skips the positive
# region, since if the difference is positive then the ISS has already
# passed the target longitude and is on its way around the rest of
# the planet.
d = longitude_difference(t)
while d > 0:
t += ephem.minute
sat.compute(t)
d = longitude_difference(t)
# We now know that we are on the negative-valued portion of the cycle,
# and that the ISS is closing in on our longitude. So we keep going
# only as long as the difference is negative, since once it jumps to
# positive the ISS has passed the target longitude, as in the sample
# data series above when the difference goes from -2:09:27.0 to
# 3:50:44.9.
while d < 0:
t += ephem.minute
sat.compute(t)
d = longitude_difference(t)
# We are now sitting at a point in time when the ISS has just passed the
# target longitude. The znorm of the longitude difference ought to be a
# gently sloping zero-crossing curve in this region, so it should be
# safe to set Newton's method to work on it!
tn = ephem.newton(longitude_difference, t - ephem.minute, t)
# This should be the answer! So we print it, and also double-check
# ourselves by printing the longitude to see how closely it matches.
print 'When did ISS cross this longitude?', target_long
print 'At this specific date and time:', ephem.date(tn)
sat.compute(tn)
print 'To double-check, at that time, sublong =', sat.sublong
我得到的输出,当运行此脚本表明,它确实已经发现的那一刻(合理的公差范围内),当国际空间站到达目标经度:
When did ISS cross this longitude? -83:53:20.0
At this specific date and time: 2013/4/20 00:18:21
To double-check, at that time, sublong = -83:53:20.1
相关问题
- 1. 使用PyEphem计算恒星的位置
- 2. 穿越迷宫的算法
- 3. pyephem - 观察者纬度/经度类型
- 4. 用于计算可视GPS卫星的库或算法
- 5. 使用PyEphem计算黎明和日落时间
- 6. 计算经纬度
- 7. 如何使用GPS纬度和经度计算海拔高度
- 8. 如何计算d3.js卫星投影的投影旋转和刻度延伸
- 9. pyEphem - 从角度到时间
- 10. 如何使用纬度和经度计算距离和方位?
- 11. 穿越链表
- 12. Android:NAT穿越?
- 13. 穿越SQLite表
- 14. PHParray穿越
- 15. vb.net穿越
- 16. 从卫星精度的Android速度
- 17. PyEphem:我可以从方位角计算太阳的高度吗
- 18. 从距离计算经度
- 19. PyEphem升/方位角为星和星座
- 20. 使用纬度/经度从mysql计算路径长度
- 21. 如何计算多次跨越阈值的浓度总时间?
- 22. 如何计算两个经度和纬度的时差
- 23. XSLT节点穿越
- 24. IPSec的NAT穿越
- 25. jQuery的nextALL穿越
- 26. 穿越阵列Javascript
- 27. NAT穿越实验?
- 28. PHP的SimpleXML穿越
- 29. NAT穿越和IPv6
- 30. 在C#中,如何创建将在设计时使用的卫星资源?
对不起,如果我的理解,在时间“2013/04/20 00:18:21”卫星从经度-83.8889的海拔高度是90º,我的意思是,“正好”高于经度-83.8889? – mikesneider 2017-03-20 13:33:44
卫星位于经度以上的某处。当然,这可能是从北极到南极的任何地方,只有沿着该经线的一个点,卫星才会直线上升。对于沿着该经线的其余站点,卫星将低于90°甚至低于地平线。 – 2017-03-24 22:46:38