skyfielders / python-skyfield

Elegant astronomy for Python
MIT License
1.4k stars 211 forks source link

de441.bsp: range date is wrong #682

Closed blucobalto closed 2 years ago

blucobalto commented 2 years ago

Hi, when i use the de441.bsp i get the following error:

Exception has occurred: EphemerisRangeError
ephemeris segment only covers dates 1969-07-29 23:59:18Z through 17191-03-14 23:58:51Z UT

This is the code used:

from skyfield.api import load

planets = load('de441.bsp')
earth, mars = planets['EARTH BARYCENTER'], planets['MARS BARYCENTER']

ts = load.timescale()
t = ts.utc(1967,1,1,0,0,0)
astrometric_mars = earth.at(t).observe(mars)
apparent_mars = astrometric_mars.apparent()
lat, lon, d = apparent_mars.ecliptic_latlon(epoch='date')
print('Mars lon ', lon)
print("Mars lat ", lat)
print("Mars dist ", d)

Thanks a lot, Blu

brandon-rhodes commented 2 years ago

On NASA’s server, the ephemeris is split into two files:

https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/

Is it possible that what you have is in fact de441_part-2.bsp?

blucobalto commented 2 years ago

You're right! I downloaded the right files and now the code works perfectly. Thanks for your valuable work.

Blu