我怎样才能让 Skyfield 同意太阳赤纬的航海年历?

How can I get Skyfield to agree with the Nautical Almanac for the Sun's Declination?

这是一个示例脚本,它使用 PyEphem 和 Skyfield 计算格林威治标准时间 00:00:00 2016/7/23 的太阳偏角:

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"

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

P.S。我正在使用 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"