gpt4 book ai didi

python - 我怎样才能让 Skyfield 同意航海年历中太阳赤纬的情况?

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

以下示例脚本使用 PyEphem 和 Skyfield 计算 2016 年 7 月 23 日 00:00:00 GMT 的太阳赤纬:

import ephem

sun1 = ephem.Sun('2016/7/23 00:00:00')
dec1 = sun1.dec

print 'PyEphem Declination:', dec1

#-------------------------------------
from skyfield.api import load

planets = load('de421.bsp')

earth = planets['earth']
sun2 = planets['sun']

ts = load.timescale()
time2 = ts.utc(2016, 7, 23)

dec2 = earth.at(time2).observe(sun2).apparent().radec()[1]

print 'Skyfield Declination:', dec2

当我运行这个时,我得到:

PyEphem Declination: 20:01:24.0
Skyfield Declination: +20deg 04' 30.0"

航海年历给出的时间为 20 度 01.4'。我不确定我做错了什么导致这种差异。谢谢!

附注我使用的是 Python 2.7 和 Skyfield 0.8。

最佳答案

PyEphem 给您的答案与年鉴完全一致,但以传统的小时-分钟-秒弧度表示,而不是小时和小数分钟。作为弧分数量 1.4 一部分的分数 .4,如果以弧秒表示,则变为 60 × 0.4 = 24 弧秒。所以:

20°1.4′ = 20°1′24″

默认情况下,Skyfield 为您提供永久 GCRS 坐标系中的坐标,该坐标系是 J2000 的更新替代品。但年鉴并不使用 2000 年的赤道和春分坐标系,而是使用它所报告的每个数据当年的赤道和春分坐标系(实际上是准确的时刻)。要要求 Skyfield 以 2016 年坐标表示赤纬,请为其指定 epoch“date”:

from skyfield.api import load

ts = load.timescale()
planets = load('de421.bsp')

earth = planets['earth']
sun = planets['sun']

t = ts.utc(2016, 7, 23)
ra, dec, distance = earth.at(t).observe(sun).apparent().radec(epoch='date')
print(dec)

结果:

+20deg 01' 24.0"

关于python - 我怎样才能让 Skyfield 同意航海年历中太阳赤纬的情况?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38539625/

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