Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""An interface between JPL ephemerides and Skyfield."""
import os
from collections import defaultdict
from jplephem.exceptions import OutOfRangeError
from jplephem.spk import SPK
from jplephem.names import target_name_pairs
from .constants import AU_KM, DAY_S
from .errors import EphemerisRangeError
from .timelib import calendar_date
from .vectorlib import VectorFunction, VectorSum, _jpl_code_name_dict
_jpl_name_code_dict = dict(
(name, target) for (target, name) in target_name_pairs
)
class SpiceKernel(object):
"""Ephemeris file in NASA .bsp format.
A "Spacecraft and Planet Kernel" (SPK) file from NASA provides
(x,y,z) coordinates for bodies in the Solar System like the Sun,
planets, moons, and spacecraft.
You can download a .bsp file yourself and use this class to open it,
or use the Skyfield ``load()`` function to automatically download a
popular ephemeris. Once loaded, you can print this object to the
screen to see a report on the segments that it includes:
>>> planets = load('de421.bsp')
>>> print(planets)