I'm a master student and I am trying to get the L2 ephemeris for some calculations in my master's project. It was kinda hard to find a file with the L2 ephemeris, but once I found it, I tried the next syntax.

from jplephem.spk import SPK
kernel = SPK.open('L2_de431.bsp')
position = kernel[3,392].compute(2457061.5)

but I'm getting an exception: "Only SPK data types 2 and 3 are supported".

I tried the same syntax with a planetary ephemeris file (de432s.bsp) and it works fine.

Can someone help me with that or knows any other ephemeris file for L2?

L2 file is here: https://naif.jpl.nasa.gov/pub/naif/generic_kernels/spk/lagrange_point/


Bad news, this type of SPK file has a different sort of interpolation that is not supported by the jplephem package (Hermite interpolation vs Chebyshev polynomials). You can find this out by doing:

In [1]: print(len(kernel.segments))                                                                                         
In [2]: print(kernel.segments[0].describe())                                                                                
2415020.50..2506696.50  Earth Barycenter (3) -> Unknown Target (392)
  frame=1 data_type=12 source=Sun-EarthMoon L2

which shows that the segment is of data type 12. Looking this up in the NAIF SPK documentation shows that this is Type 12: Hermite Interpolation --- Equal Time Steps; looking in the jplephem code in the spk.Segment._load() routine, shows the code that produces the error you are seeing and the supported types (2 and 3). According to the NAIF SPK docs these are Type 2: Chebyshev (position only) and Type 3: Chebyshev (position and velocity).

I think your options are either:

  1. add support for this type of interpolation to jplephem (the math is at least documented in NAIF docs),
  2. see if SpiceyPy has support for this more unusual type of SPK/BSP,
  3. find an alternative source for an L2 ephemeris.
| improve this answer | |
  • $\begingroup$ Yeah... those are bad news indeed. I'm trying Spice toolkit, hope I will get same results and get used to the new syntax. Thank you! $\endgroup$ – Luis García Iglesias Oct 29 '19 at 8:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.