SuperNOVAS v1.5
The NOVAS C library, made better
Loading...
Searching...
No Matches
solsys-cspice.c File Reference

Solar-system ephemeris lookup via the NAIF CSPICE library. More...

Functions

int cspice_add_kernel (const char *filename)
 Adds a SPICE kernel to the currently managed open kernels.
 
int cspice_remove_kernel (const char *filename)
 Removes a SPICE kernel from the currently managed open kernels.
 
int novas_use_cspice ()
 Sets CSPICE as the default ephemeris provider for all types of Solar-system objects (both NOVAS_PLANET and NOVAS_EPHEM_OBJECT types).
 
int novas_use_cspice_ephem ()
 Sets a ephemeris provider for NOVAS_EPHEM_OBJECT types using the NAIF CSPICE library.
 
int novas_use_cspice_planets ()
 Sets CSPICE as the ephemeris provider for the major planets (and Sun, Moon, SSB...) using the NAIF CSPICE library.
 

Detailed Description

Solar-system ephemeris lookup via the NAIF CSPICE library.

This is an optional component of SuperNOVAS, which interfaces to the NAIF CSPICE Toolkit. As such, you may need the CSPICE runtime libraries in an accessible location (such as in /usr/lib), and you will need development files (C headers under a cspice/ sub-folder, such as in /usr/include/cspice/; and unversioned libraries) to build. Thus, this module is compiled only if CSPICE_SUPPORT is set to 1 prior to the build.

Before building SuperNOVAS against CSPICE, you might want to check out the Smithsonian/cspice-sharedlib repository on Github to facilitate the building of CSPICE as a shared library instead of the static library built by the uptream distribution.

To use, simply include novas-cspice.h in your application source, load the requisite SPICE kernels (ephemeris data and more) using cspice_add_kernel(), and then activate them with novas_use_cspice(). E.g.,

#include <novas.h>
#include <novas-cspice.h>
// You can load the desired kernels for CSPICE
// E.g. load DE440s and the Mars satellites:
int status;
status = cspice_add_kernel("/path/to/de440s.bsp");
if(status < 0) {
// oops, the kernels must not have loaded...
...
}
// Load additional kernels as needed...
status = cspice_add_kernel("/path/to/mar097.bsp");
...
// Then use CSPICE as your SuperNOVAS ephemeris provider
novas_use_cspice();
int cspice_add_kernel(const char *filename)
Adds a SPICE kernel to the currently managed open kernels.
Definition solsys-cspice.c:167
SuperNOVAS functions interfacing with the NAIF CSPICE Toolkit.
SuperNOVAS types, definitions, and function prototypes.

The CSPICE plugin will use the ID numbers stored in the object structure. For planets, it will automatically translate NOVAS planet IDs to NAIF IDs, while for other Solar-system bodies, you should set the NAIF ID when defining the object via make_ephem_object(). If the ID is set to -1, then name-based lookup will be used instead.

REFERENCES:

  1. The NAIF CSPICE Toolkit: https://naif.jpl.nasa.gov/naif/toolkit.html
  2. the Smithsonian/cspice-sharedlib repository: https://github.com/Smithsonian/cspice-sharedlib
Author
Attila Kovacs
Since
1.2
See also
solsys-calceph.c, ephemeris.c, orbital.c