Skyfield 确实获得了对彗星的支持!您可以在此处找到详细信息:
https://rhodesmill.org/skyfield/kepler-orbits.html#comets
改编文档中的代码,这是从小行星中心数据库到彗星的距离:
from skyfield.api import load
from skyfield.constants import GM_SUN_Pitjeva_2005_km3_s2 as GM_SUN
from skyfield.data import mpc
ts = load.timescale()
eph = load('de421.bsp')
sun, earth = eph['sun'], eph['earth']
with load.open(mpc.COMET_URL) as f:
comets = mpc.load_comets_dataframe(f)
comets = comets.set_index('designation', drop=False)
row = comets.loc['1P/Halley']
comet = sun + mpc.comet_orbit(row, ts, GM_SUN)
t = ts.utc(2020, 10, 17)
ra, dec, distance = earth.at(t).observe(comet).radec()
print('Distance in AU:', distance.au)
我看到了结果:
Distance in AU: 35.22790002485247