skyfielders / python-skyfield

Elegant astronomy for Python
MIT License
1.39k stars 209 forks source link

"kernel 'de430.bsp' is missing 'MARS' #749

Closed delcompan closed 2 years ago

delcompan commented 2 years ago

This is my first time using skyfield. eph = load('de/de430.bsp') mars = eph['mars'] ... KeyError: "kernel 'de430.bsp' is missing 'MARS' - the targets it supports are: 0 SOLAR SYSTEM BARYCENTER, 1 MERCURY BARYCENTER, 2 VENUS BARYCENTER, 3 EARTH BARYCENTER, 4 MARS BARYCENTER, 5 JUPITER BARYCENTER, 6 SATURN BARYCENTER, 7 URANUS BARYCENTER, 8 NEPTUNE BARYCENTER, 9 PLUTO BARYCENTER, 10 SUN, 199 MERCURY, 299 VENUS, 301 MOON, 399 EARTH" but when eph = load('de/de421.bsp') mars = eph['mars'], there is no error. why?

Bernmeister commented 2 years ago

Perhaps look here which will tell you how to peek inside the .bsp to see what segments (planets or otherwise) are present. I found a document which seems to list the segments for the file and mars is not present yet MARS BARYCENTER is...so try that.

delcompan commented 2 years ago

Thank you very much.

delcompan commented 2 years ago

https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/de430_tech-comments.txt

This URL is not accessible in China.

Bernmeister commented 2 years ago

https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/planets/de430_tech-comments.txt

This URL is not accessible in China.

That document lists (what I believe to be) the segments in de430.bsp.

Regardless, using the method described in the documentation (refer to the link in my original answer), you should be able to list the segments directly (and determine the correct name for the body you want and if that body is present in any of the segments).

I grabbed the relevant section from the NASA document:

Bodies included: 

        MERCURY BARYCENTER (1)  SATURN BARYCENTER (6)   MERCURY (199)
        VENUS BARYCENTER (2)    URANUS BARYCENTER (7)   VENUS (299)
        EARTH BARYCENTER (3)    NEPTUNE BARYCENTER (8)  MOON (301)
        MARS BARYCENTER (4)     PLUTO BARYCENTER (9)    EARTH (399)
        JUPITER BARYCENTER (5)  SUN (10)                TT-TDB (1000000001)

...which (unsurprisingly) looks just like the contents of the original error message you got!

delcompan commented 2 years ago

Anyway, thanks for your enthusiasm and help.

brandon-rhodes commented 2 years ago

As I hope you are now asking the ephemeris kernel DE430 for the position of the Mars system barycenter, instead of Mars itself, I'm going to go ahead and close this issue. But if you have any further questions, please feel free to comment further!