0

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?

Eliseo Ocampos
  • 2,473
  • 4
  • 20
  • 32
geode
  • 1
  • 3
  • It looks like it may be a library installation issue. – R. Barzell Mar 11 '14 at 12:39
  • Welcome to StackOverflow! Are you sure that to the `Ephemeris` function you need to give the de405 argument? You give a function to another function. Check the help page of the Ephemeris function to know what should you give it. – llrs Mar 11 '14 at 12:42
  • Llopis: i did as shown in here http://rhodesmill.org/skyfield/planets.html and thanks alot for Welcome :) – geode Mar 11 '14 at 12:53
  • What command did you use to install Skyfield and de405? And: can we assume that all of the spaces between `site-` and `packages` are just a result of the way that you cut-and-pasted? Because there should be no spaces inside of that directory name :) – Brandon Rhodes Mar 12 '14 at 02:45
  • oh :) Hello Brandon. The space is because of copy-paste. i installed skyfield using pip and the de405 package was alittle bit hard to install. i dont remember how i achieved in de405 but for windows if you have any good instructions to download i will be so happy :) and here https://pypi.python.org/pypi/de405 i couldnt find de405 download link. the point i use de405 is compute earth-sun distances for landsat calibration. In all papers for landsat calibration the distances are computed using this ephemeris. i used de421 too but in some epochs that i try there are differences with de405 – geode Mar 12 '14 at 14:52

0 Answers0