不需要直接读出来数据来自己计算每个行星的位置 , 只需要通过通用的程序调用计算就行了。不需要具体了解 历表里面数据是什么。历表的调用方式如下代码:
from jplephem.spk import SPK
import numpy as np
kernel=SPK.open('de200.bsp')
#Here is how to compute the coordinates of Mars (target 4) relative to the Solar System barycenter (target 0) at midnight 2015 February 8 TDB (Barycentric Dynamical Time), using the Julian date we just computed:
position = kernel[0,4].compute(2457061.5) # Mars (target 4)
print(position) # [2.057e+08 4.251e+07 1.394e+07]
'''
Solar System Barycenter (0) -> Mercury Barycenter (1)
Solar System Barycenter (0) -> Venus Barycenter (2)
Solar System Barycenter (0) -> Earth Barycenter (3)
Solar System Barycenter (0) -> Mars Barycenter (4)
Solar System Barycenter (0) -> Jupiter Barycenter (5)
Solar System Barycenter (0) -> Saturn Barycenter (6)
Solar System Barycenter (0) -> Uranus Barycenter (7)
Solar System Barycenter (0) -> Neptune Barycenter (8)
Solar System Barycenter (0) -> Pluto Barycenter (9)
Solar System Barycenter (0) -> Sun (10)