Pyephem地球 - 太阳距离在AU与de405星历

时间:2014-03-11 12:36:42

标签: python astronomy pyephem

在一个项目中,我必须用de405星历来计算天文单位的地球太阳距离。我使用pyephemjplephemskyfield也安装了de405包但无法实现并编写此代码:

from skyfield.jpllib import Ephemeris
import de405

def esundist(d_year, d_month, d_day):
    eph = Ephemeris(de405)
    astro = eph.earth(utc=(d_year, d_month, d_year)).observe(eph.sun)
    ra, dec, distance = astro.radec
    print distance.AU
esundist(2005, 10, 21)

但是这段代码会出现这样的错误:

Traceback (most recent call last):
File "C:/Users/Predator/PycharmProjects/s/cal.py", line 33, in <module>
esundist(2005,10,21)
File "C:/Users/Predator/PycharmProjects/s/cal.py", line 21, in esundist        
eph = Ephemeris(de405)
File "C:\Python26\lib\site-packages\skyfield\jpllib.py", line 103, in __init__
self.jplephemeris = jplephem.Ephemeris(module)
File "C:\Python26\lib\site-packages\jplephem\ephem.py", line 21, in __init__
self.__dict__.update((k.decode('ascii'), v) for k, v in np.load(path))
File "C:\Python26\lib\site-packages\numpy\lib\npyio.py", line 358, in load
fid = open(file, "rb")
IOError: [Errno 2] No such file or directory: 'C:\\Python26\\lib\\site-   packages\\de405\\constants.npy'

我想要的只是计算AU中从地球到太阳的距离。如果可能,请在de405中使用pyephem

0 个答案:

没有答案