A wrapper to CALCEPH: IMCCE planetary ephemeris access library


Build Status AppVoyer Coverage Status codecov.io

This is a julia wrapper for CALCEPH a C library for reading planetary ephemeris files, such as INPOPxx, JPL DExxx and SPICE ephemeris files.

CALCEPH C library is developped by IMCCE.

Quick start

In the Julia interpreter, run:

using Pkg

# ephemeris kernels can be downloaded from many different sources

# create an ephemeris context
eph = Ephem("planets.dat")

# prefetch ephemeris files data to main memory for faster access

# retrieve constants from ephemeris as a dictionary
con = constants(eph)
# list the constants
# get the sun J2
J2sun = con[:J2SUN]

# retrieve the position, velocity and acceleration of Earth (geocenter) relative
# to the Earth-Moon system barycenter in kilometers, kilometers per second and
# kilometers per second square at JD= 2451624.5 TDB timescale
# for best accuracy the first time argument should be the integer part and the
# delta the fractional part
# when using NAIF identification numbers, useNaifId has to be added to
# the units argument.

# what is the NAIF identification number for Deimos
id_deimos = naifId.id[:deimos]

# what does NAIF ID 0 correspond to?
names_0 = naifId.names[0]

Why use CALCEPH?

CALCEPH functionality is also provided by NAIF SPICE Toolkit. However CALCEPH has several advantages over the SPICE toolkit, mainly:

  • It can handle multiple ephemeris contexts.
  • It is thread safe (if using one context per thread).
  • It can compute higher order derivatives (acceleration and jerk) approximation using differentiation of the interpolation polynomials.
  • Its ephemeris computation interface expects the time separated in two double precision floating point numbers. This can be used to achieve higher precision in timetag (this can have a significant impact when modeling Doppler observations from a deep space probe).

But CALCEPH does not support all functions of the SPICE toolkit. If you need more functionalities SPICE.jl is a Julia wrapper for the SPICE toolkit.

First Commit


Last Touched

3 months ago


113 commits

Used By: