In a project I have to calculate the earth sun distances in astronomical units with de405
ephemeris. I used pyephem
, jplephem
, skyfield
also installed de405
package but couldn't achieve and wrote this code:
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)
But this code gives an error like this:
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'
The thing that I just want is just to calculate the distance from earth to sun in AU. using de405
in pyephem
if possible?