PEPPER (Planetary Ephemerides, Positions, Pointing, Events & Rotations)!

Behold PEPPER (Planetary Ephemerides, Positions, Pointing, Events & Rotations)!

This is a comprehensive refactoring and modernization to modern Fortran of JPL’s SPICELIB Toolkit, one of the great workhorse libraries of astrodynamics. Developed for decades at JPL, but unfortunately in Fortran 77. SPICELIB has always had many limitations due to the limitations of Fortran 77 (global state, static storage, not thread safe, etc.) Their only plan for dealing with this is to eventually (we’ve been waiting about 10 years) convert it all to C++. But that wasn’t a good idea then, and is an even worse idea now.

The refactoring into PEPPER removes all the existing limitations. It’s now object-oriented and thread-safe. Some of the modernizations also allow us to make it run faster. There are also some new options not available or not possible in the old code. More to come.

To provide C/Python interfaces before, SPICELIB was f2c’d and then custom wrappers were written to produce a completely separate library called CSPICE. CSPICE is the library that is used by the Python wrapper (SpiceyPy). It inherited most of the limitations of the original (i.e., it also wasn’t thread-safe). PEPPER now exposes a C-interface and a Python interface, which is thread-safe and faster than SpiceyPy. PEPPER is also faster than ANISE an alternative to SPICE rewritten from the ground up in Rust.

All that monstrous Fortran 77 code was fundamentally still good, it just needed to be cleaned up and brought into the modern world. There’s no good reason to have to convert it to a different programming language. This is how legacy Fortran code like this should have been maintained and updated over the past 10-20 years. Now, with AI-assistance, we can do it in a few days.

12 Likes

Beautiful. Indeed, 100% agree with everything you wrote. Thank you for modernizing all these old projects.

2 Likes