In december 2018, JPL/NAIF announced an experimental API RESTful interface for their new WebGeocalc server (which make online SPICE calculations). Documentation and JavaScript examples are already available.
This package is an early attempt to provide a Python interface to make SPICE calculation through this API.
This project is not supported or endorsed by either JPL, NAIF or NASA. The code is provided "as is", use at your own risk.
from webgeocalc import API
API.url
The default API endpoint can be defined with the WGC_URL
global environment variable.
If it is not present, the API
will fallback to the JPL endpoint.
You can also use the ESA webgeocalc server:
from webgeocalc import ESA_API
ESA_API.url
kernel_sets = API.kernel_sets() # /kernel-sets
kernel_sets
kernel_set = kernel_sets[0]
int(kernel_set) # kernelSetId
str(kernel_set) # Caption
kernel_set.description # Get kernel attribute
kernel_set.keys()
kernel_set.values()
dict(kernel_set.items())
id
or caption name
:¶# By ID
API.kernel_set(1)
# By full caption name
API.kernel_set('Solar System Kernels')
# Not case sensitive
API.kernel_set('solar system kernels')
# Search by partial name
API.kernel_set('Solar')
from webgeocalc.errors import TooManyKernelSets, KernelSetNotFound
# More than one kernel found
try:
API.kernel_set('Cassini')
except TooManyKernelSets as err:
print(err)
# Kernel not found
try:
API.kernel_set('Missing kernel')
except KernelSetNotFound as err:
print(err)
bodies = API.bodies(5) # /kernel-set/{kernelSetId}/bodies
# or
API.bodies('Cassini Huygens')
body = bodies[0]
print(f"Body `id`: {int(body)} and `name`: {str(body)}")
frames = API.frames(5) # /kernel-set/{kernelSetId}/frames
# or
API.frames('Cassini Huygens')
frames[58].items()
instruments = API.instruments(5) # /kernel-set/{kernelSetId}/intruments
# or
API.instruments('Cassini Huygens')
print(f"Body `id`: {int(instruments[0])} and `name`: {str(instruments[0])}")
Next: Make a calculation