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

Functions

int cspice_add_kernel (const char *filename)
 
int cspice_remove_kernel (const char *filename)
 
int novas_use_cspice ()
 
int novas_use_cspice_ephem ()
 
int novas_use_cspice_planets ()
 

Detailed Description

Author
A. Kovacs
Since
1.2

SuperNOVAS Solar-system ephemeris lookup implementation 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.

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
See also
solarsystem.h
solsys-calceph.c

Function Documentation

◆ cspice_add_kernel()

int cspice_add_kernel ( const char *  filename)

Adds a SPICE kernel to the currently managed open kernels. Subsequent ephemeris lookups through CSPICE will use the added kernel. It's simply a wrapper around the CSPICE furnsh_c() routine, with graceful error handling. You can of course add kernels using furnsh_c() directly to the same effect.

REFERENCES:

  1. https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/furnsh_c.html
Parameters
filenameThe fully qualified path to the ephemeris kernel data (e.g. "/data/ephem/de440s.bsp")
Returns
0 if successful, or else -1 if there was an error (errno will be set to EINVAL).
See also
cspice_remove_kernel()
novas_use_cspice()
Author
Attila Kovacs
Since
1.2

◆ cspice_remove_kernel()

int cspice_remove_kernel ( const char *  filename)

Removes a SPICE kernel from the currently managed open kernels. Subsequent ephemeris lookups through CSPICE will not use the removed kernel data. It's simply a wrapper around the CSPICE unload_c() routine, with graceful error handling. You can of course remove kernels using unload_c() directly to the same effect.

REFERENCES:

  1. https://naif.jpl.nasa.gov/pub/naif/toolkit_docs/C/cspice/unload_c.html
Parameters
filenameThe fully qualified path to the ephemeris kernel data (e.g. "/data/ephem/de440s.bsp")
Returns
0 if successful, or else -1 if there was an error (errno will be set to EINVAL).
See also
cspice_add_kernel()
Author
Attila Kovacs
Since
1.2

◆ novas_use_cspice()

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).

CSPICE is configured to suppress error messages and to not exit on errors, since we will check errors and handle them ourselves. You can adjust the behavior after this call with the CSPICE errprt_c() and erract_c() functions, respectively.

Returns
0
See also
novas_use_cspice_planets()
novas_use_cspice_ephem()
cspice_add_kernel()
Author
Attila Kovacs
Since
1.2

References novas_use_cspice_ephem(), and novas_use_cspice_planets().

◆ novas_use_cspice_ephem()

int novas_use_cspice_ephem ( )

Sets a ephemeris provider for NOVAS_EPHEM_OBJECT types using the NAIF CSPICE library.

CSPICE is configured to suppress error messages and to not exit on errors, since we will check errors and handle them ourselves. You can adjust the behavior after this call with the CSPICE errprt_c() and erract_c() functions, respectively.

Returns
0
See also
novas_use_cspice_planets()
novas_use_cspice()
cspice_add_kernel()
set_ephem_provider()
Author
Attila Kovacs
Since
1.2

References set_ephem_provider().

◆ novas_use_cspice_planets()

int novas_use_cspice_planets ( )

Sets CSPICE as the ephemeris provider for the major planets (and Sun, Moon, SSB...) using the NAIF CSPICE library.

CSPICE is configured to suppress error messages and to not exit on errors, since we will check errors and handle them ourselves. You can adjust the behavior after this call with the CSPICE errprt_c() and erract_c() functions, respectively.

Returns
0
See also
novas_use_cspice_ephem()
novas_use_cspice()
cspice_add_kernel()
set_planet_provider()
set_planet_provider_hp()
Author
Attila Kovacs
Since
1.2

References set_planet_provider(), and set_planet_provider_hp().