-
-
Notifications
You must be signed in to change notification settings - Fork 237
Description
I have been using the Horizons telnet interface to generate binary SPK files for small solar system bodies. When I try to load them in skyfield I get this error:
File "skyfield\jpllib.py", line 179, in __new__
.format(spk_segment.data_type))
ValueError: SPK data type 1 not yet supported segment
which seems to be referring to the data types discussed here:
https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/req/spk.html#Supported%20Data%20Types
Horizons is able to produce SPK files in a few different formats. The extended help for the file type selection prompt says this:
[B]inary ... produce BINARY SPK file (.bsp). RECOMMENDED.
[T]ext ... produce ASCII transfer file (.xsp). DEPRECATED.
1 ... produce legacy Type 1 binary format SPK file. DEPRECATED.
- ... move back to previous prompt
? ... display a brief help file for this prompt
?! ... display this extended help file
X or Q ... immediately disconnect from Horizons system
* The initial default SPK format is "BINARY". It is recommended this option
be used.
...
* The '1' response produces a Type 1 binary SPK file for use with older
software linked against version of the SPICE Toolkit library prior to
N0065. It is recommended users update to more recent SPICE reader libraries
and not use this legacy option.
* The alternate ASCII text form is deprecated and no longer necessary for
users who link their software against N0052 and later version of the SPICE
Toolkit reader library. However, if selected anyway, users must then
convert the resulting ASCII format file to binary by running the SPICE
utility program 'tobin', or 'spacit' on their local machines. Note that
Horizons first produces the file in binary format then converts it to
the ASCII transfer format if requested.
This seems to be implying that there are regular binary SPK files, and also legacy type 1 binary SPK files, but files created with either of these options all produce the same error I included above. I've tried this for a number of the largest small bodies (ceres, pallas, eris, etc.), and Horizons seems to only be capable of producing type 1 SPK files.
Based on a look through skyfield.jpllib.py it seems that skyfield currently supports data types 2 & 3.
The problem could be that I'm using Horizons incorrectly, but if it's not are there any plans to support data type 1 SPK files? That would allow skyfield to be used for asteroids, dwarf planets other than pluto, and comets.
Thanks!
P.S. Another small issue is that after failing to load a type 1 SPK file, I tried to rename it and I got a dialog saying "The action can't be completed because the file is open in Python." Is the file not being properly closed if that exception is raised?