Ruby SPICE Wrapper

Overview

The Ruby SPICE wrapper was written by the LROC SOC to allow for precise computation of various orbital and spacecraft geometry in the Ruby language. The wrapper passes calls in Ruby through to a subset of the functions available in NAIF's CSPICE toolkit.

Lunaserv Usage

In the context of Lunaserv, the Ruby SPICE wrapper is used to get the sub-solar point on various bodies at requested times. If you're using the night or illumination layer types in Lunaserv, you will need to download and install the Ruby SPICE wrapper and appropriate spice data for the body of interest. Both of these items can be downloaded from the downloads page. Additional SPICE kernels are available directly from NAIF. The SPICE kernels we have made available there include data for all planets in the solar system and also data for the Jupiter and Saturn systems.

LROC Usage

The LROC SOC uses the Ruby SPICE wrapper in the data processing pipeline to calculate geometry for observations, and by many of the operations tools any time SPICE is needed but a compiled C application would be too cumbersome to create and use. Since development within the Ruby programming environment is relatively quick (and easy to learn), the LROC SOC operations staff uses the Ruby SPICE wrappers for everything from quick one-off scripts, to programs and scripts routinely used in both for observation planning and in the processing pipeline. The Ruby SPICE wrapper is also used by Lunaserv when calculating sub-solar points for the simple day/night (spherical) and DTM-based illumination layer types. Because of the accessibility of the Ruby language, the Ruby SPICE wrapper is also used to train new LROC SOC employees on SPICE basics.

Installation

The current version of the naif-spice gem includes the necessary spice files for compilation on OS X, both 32 & 64 bit Linux, and Linux on the Raspberry Pi. If you are using one of those platforms, try installing the gem like you normally would. If you're using a different platform or if you get errors compiling against the spice library, then follow these instructions to compile against a downloaded version of the CSPICE toolkit. First download the appropriate CSPICE toolkit from NAIF. Then unpack the toolkit. Go into the lib directory and copy cspice.a to libcspice.a so gcc can find it. Then run the following command:

gem install --local /path/to/naif-spice.gem -- --with-cspice-dir=/path/to/cspice

Update the paths as necessary to point to the proper locations.

Documentation & Information

For supporting documentation, further information, or to help you get started, please refer to the following resources.