gpt4 book ai didi

python - Pyephem 和 pypredict/gpredict 差异

转载 作者:太空宇宙 更新时间:2023-11-03 21:44:32 25 4
gpt4 key购买 nike

我正在尝试使用 pyephem 来预测地面站的卫星通过情况。但是,我得到的结果与使用 pypredict 和 gpredict 得到的结果有很大不同。这是我写的代码。

import ephem
import predict
import datetime as dt

def passes(station, satellite, start=None, duration=7):
result = []
if start is not None:
station.date = ephem.date(start)
end = ephem.date(station.date + duration)
while station.date < end:
t_aos, azr, t_max, elt, t_los, azs = station.next_pass(satellite)
result.append({'aos': t_aos.datetime(), 'los': t_los.datetime()})
station.date = t_los + ephem.second
return result

tle = """ISS (ZARYA)
1 25544U 98067A 18274.33960752 .00001880 00000-0 36095-4 0 9991
2 25544 51.6416 209.7138 0003794 227.2741 275.6194 15.53757611135029"""

station = ephem.Observer()
station.lat = 20
station.long = 0
station.elev = 0

epoch = dt.datetime.utcnow()

for i in passes(station, ephem.readtle(*tle.split("\n")), epoch, 1):
print(i['aos'], i['los'])

print("===============")
p = predict.transits(tle, (station.lat, -station.long, station.elev), (epoch - dt.datetime(1970,1,1)).total_seconds())
for i in range(1, 8):
transit = p.next()
print(dt.datetime.utcfromtimestamp(transit.start), dt.datetime.utcfromtimestamp(transit.end))

结果

(datetime.datetime(2018, 10, 1, 17, 4, 43, 552230), datetime.datetime(2018, 10, 1, 17, 11, 12, 744164))
(datetime.datetime(2018, 10, 1, 18, 39, 4, 59194), datetime.datetime(2018, 10, 1, 18, 47, 5, 185600))
(datetime.datetime(2018, 10, 1, 20, 14, 28, 126953), datetime.datetime(2018, 10, 1, 20, 22, 3, 101339))
(datetime.datetime(2018, 10, 1, 21, 51, 6, 130556), datetime.datetime(2018, 10, 1, 21, 55, 21, 829297))
(datetime.datetime(2018, 10, 2, 16, 13, 51, 767026), datetime.datetime(2018, 10, 2, 16, 19, 13, 556850))
===============
(datetime.datetime(2018, 10, 1, 13, 43, 6, 584816), datetime.datetime(2018, 10, 1, 13, 53, 21, 721679))
(datetime.datetime(2018, 10, 1, 15, 20, 13, 473098), datetime.datetime(2018, 10, 1, 15, 29, 13, 799433))
(datetime.datetime(2018, 10, 1, 21, 58, 25, 378030), datetime.datetime(2018, 10, 1, 22, 1, 54, 993473))
(datetime.datetime(2018, 10, 1, 23, 32, 5, 284033), datetime.datetime(2018, 10, 1, 23, 42, 37, 942300))
(datetime.datetime(2018, 10, 2, 1, 9, 49, 741668), datetime.datetime(2018, 10, 2, 1, 17, 12, 346213))
(datetime.datetime(2018, 10, 2, 12, 51, 59, 647871), datetime.datetime(2018, 10, 2, 13, 0, 57, 292565))
(datetime.datetime(2018, 10, 2, 14, 27, 39, 19468), datetime.datetime(2018, 10, 2, 14, 37, 48, 730909))

我对脓毒症做错了什么?

最佳答案

如果我没记错的话,PyEphem 中一个非常尴尬的界面决定是作为 float 提供的角度是弧度。 (我开始编写 Skyfield 的原因之一是拥有一个没有这个问题的天文学库!)

尝试:

station.lat = '20.0'

关于python - Pyephem 和 pypredict/gpredict 差异,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52591629/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com