skyfielders / python-skyfield

Elegant astronomy for Python
MIT License
1.41k stars 212 forks source link

SPK data type 17 not yet supported #858

Open reza-ghazi opened 1 year ago

reza-ghazi commented 1 year ago

I tried to load sat415.bsp, but I got the following error:

Traceback (most recent call last):
  File "C:\astro\load_ephemeris.py", line 19, in <module>                            
    eph = load('./data/sat415.bsp')                                                                                         
          ^^^^^^^^^^^^^^^^^^^^^^^^^                                                                                         
  File "C:\Users\...\AppData\Local\Programs\Python\Python311\Lib\site-packages\skyfield\iokit.py", line 201, in __call__  
    return opener(path)                                                                                                     
           ^^^^^^^^^^^^                                                                                                     
  File "C:\Users\...\AppData\Local\Programs\Python\Python311\Lib\site-packages\skyfield\jpllib.py", line 72, in __init__  
    self.segments = [SPICESegment(self, s) for s in self.spk.segments]                                                      
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^                                                      
  File "C:\Users\...\AppData\Local\Programs\Python\Python311\Lib\site-packages\skyfield\jpllib.py", line 72, in <listcomp>
    self.segments = [SPICESegment(self, s) for s in self.spk.segments]                                                      
                     ^^^^^^^^^^^^^^^^^^^^^                                                                                  
  File "C:\Users\...\AppData\Local\Programs\Python\Python311\Lib\site-packages\skyfield\jpllib.py", line 197, in __new__  
    raise ValueError('SPK data type {0} not yet supported'                                                                  
ValueError: SPK data type 17 not yet supported  
brandon-rhodes commented 1 year ago

Interesting, I have not run across that ephemeris type before. Here's its description:

https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/req/spk.html#Type%2017:%20Equinoctial%20Elements

Normally the underlying jplephem library needs to be extended when we run across a new ephemeris type. But it looks like in this case there's no data series to interpolate, which is jplephem's specialty, but rather elliptical orbital elements that Skyfield might know how to deal with. Someone should experiment with seeing if an elliptical orbit object could be created from the elements in the segment, and if a position generated from them would match what SPICE does with the same segment.

In any case, I'll mark this as a valid feature request!

reza-ghazi commented 1 year ago

Thank you for the response. I'll let you know if I find anything that can help.