Pyephem和Skyfield HA/DEC结果之间的差异
我正在重构一些使用 PyEphem 的旧代码来使用 Skyfield,并且我发现物体的 GHA/dec 结果略有不同。
def sf(year):
from skyfield.api import N, W, wgs84
from skyfield.api import load
from skyfield.units import Angle
ts = load.timescale()
eph = load('de421.bsp')
greenwich = wgs84.latlon(58.47722 * N, 0.0 * W)
t = ts.utc(year)
e = eph['earth'] + greenwich
v = eph['venus']
ha = e.at(t).observe(v).hadec()
gha = Angle(degrees=360.0 + ha[0]._degrees)
print(f'{gha}, {ha[1]}')
def pe(year):
import ephem
greenwich = ephem.Observer()
greenwich.lon = 0.0
greenwich.lat = ephem.degrees('51:28:38')
greenwich.pressure = 0.0
greenwich.horizon = '-0:34'
t = ephem.date(str(year))
v = ephem.Venus()
greenwich.date = t
greenwich.epoch = t
v.compute(greenwich)
gha = ephem.twopi - v.g_ra + greenwich.sidereal_time()
print(f'{ephem.degrees(gha)}, {ephem.degrees(v.g_dec)}')
if __name__ == '__main__':
sf(2016)
pe(2016)
产生结果:
219deg 41' 57.5", -18deg 37' 03.9"
219:42:15.7, -18:36:56.0
旧的 PyEphem 代码与我面前的航海年历一致。
这绝对是 PEBKAC,但我正在绞尽脑汁地寻找我错过的时间或空间转换。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看来您正在向Skyfield索要天文姿势,但Pyephem却担任明显的位置。根据Pyephem文档:
“ G_RA和RA-明显的GeCentric右升华,以时期的日期”
https://rhodesmill.org/pyephem/quick.html#body-compute-date
与Skyfield有关学习相应的明显位置的位置;它不会自动发生:
查看该变化是否消除了坐标之间的大部分差异。
It looks like you are asking Skyfield for astrometric positions, but PyEphem for apparent positions. According to the PyEphem documentation:
"g_ra and ra — Apparent geocentric right ascension for the epoch-of-date"
https://rhodesmill.org/pyephem/quick.html#body-compute-date
Whereas with Skyfield, you have to call the
.apparent()
method on a position to learn the corresponding apparent position; it does not happen automatically:https://rhodesmill.org/skyfield/positions.html#barycentric-astrometric-apparent
See if that change eliminates most of the difference between coordinates.