Ephemerides from JPL Horizons

Ephemeris is a strange word that evokes both scientific and mystical ideas.

For millennia it has been more an astrological term than a scientific one.  But it does reflect the protoscientific knowledge of the clockwork nature of the heavens — an observation that surely pre-dates any mechanical clock.  It properly refers only to periodic phenomena; interestingly, irregular phenomena are termed secular.  And it is from a wholly empirical stance that this post encounters it.  (Unlike Keats, perhaps, my imagination is spurred by the prospect of scientific understanding.)

This fantastic tool from NASA’s Jet Propulsion Lab provides ephemerides for objects in the solar system.  It uses “all known physics” to numerically integrate the positions of more than half a million asteroids, planets, moons, comets and spacecraft.  It has web, telnet and email interfaces!  Nowadays, we probably should credit it with having a service-oriented API, albeit one over protocols other than HTTP (the web interface appears to be stateful and not in the same vein as REST, etc.).

Yesterday I sent it the following email:

To: horizons
Subject: JOB

!$$SOF
COMMAND= '10','199','299','399','499','599','699','799','899','999'
CENTER= '500@0'
MAKE_EPHEM= 'YES'
TABLE_TYPE= 'VECTORS'
START_TIME= '2011-02-09'
STOP_TIME= '2011-02-10'
STEP_SIZE= '1 d'
OUT_UNITS= 'KM-S'
VECT_TABLE= '2'
REF_PLANE= 'ECLIPTIC'
REF_SYSTEM= 'J2000'
VECT_CORR= 'NONE'
VEC_LABELS= 'NO'
CSV_FORMAT= 'YES'
OBJ_DATA= 'YES'
!$$EOF

Now, most of that was written for me by the web interface.  All I had to do was customise the list of commands to include the identifiers for the ten bodies I’m interested in.  These are easily obtained from the web interface (or alternatively, through email; it also accepts names but numbers seem more precise).  I have asked it for plain vectors (position and velocity), relative to the solar system barycentre (id 500), in units of km and s.

Within a couple of minutes I received 10 emails, each containing vital statistics and ephemeris data over the last two days for a planet.  There was some manual copy-and-paste work to get the data into my program, but that could easily be automated for larger scales.  Its orderliness is perspicuously demonstrated by a calculation of the planetary orbits (click to show animation):

Orbits for ten bodies from 9th Feb 2011

This is the sun, the eight planets, and, for old times’ sake, Pluto, from Julian Day 2455601.5 (i.e. 9th of February), for 250 years (approximately one orbit of Pluto).  I’ve not yet put much effort into graphical output, as you can see.

It is an impressive tool and I could happily let its creators rest on their laurels.  But if there is still development on it, there are a couple of improvements I would benefit from:  1. the option of receiving all responses to a single request as a single email; and 2. the ability to specify a single date; my request would return data for two subsequent days, but reducing the range by one day would result in an error.  This cost an exhorbitant 1000 or so unnecessary bytes of mail data.  Worse than that, it aroused my programmer’s instinct for generality and tendency to pedanticism.  ;-)  (The “logical” approach, of course, is to generate for dates d where ad < b: in my case, the given input would yield the desired answer.)

Advertisements
This entry was posted in Science, Simulation and tagged , . Bookmark the permalink.

6 Responses to Ephemerides from JPL Horizons

  1. Richard says:

    Interesting article. Couldn’t you integrate telnet instead of using email? I’m sure this would be quite suitable in comparison to email. Although i would require a reasonable amount of work!

  2. ejrh says:

    Hmm, yes — even just pasting in a bunch of commands, and copying all the output from the terminal. The problem is that the telnet interface is interactive. This means it’s optimised for use where the requester can read each response and decide what their next command is. A batch interface on the other hand expects all the input up front, and responds to it once at the end. In principle you can queue up all your commands just right for an interactive interface. But the expectation is that the requester will adapt to each response and so the command language tends not to be designed for batch use. For example, the telnet interface for Horizons will either accept a planet selection, or pop up a scrollable list of possible matches if it’s ambiguous. Unless you can predict in advance exactly how it responds to each one, you can’t just paste in a list of commands and expect it to work. You need either to have a human typing them in and reading each response, or you need to program something to do that for you.

  3. Pingback: Faking relativity | EJRH

  4. eqbridges says:

    interesting article! i especially like the animation you did, it really helps to visualize the numbers. here’s a link to the work i’ve done with the ephemeris data (still buggy…) http://1au.com/oneau/ cheers Ed

    • ejrh says:

      Thanks! It’s still quite primitive — all it does is render a sequence of images. I’m slowly working up the confidence (or audacity) to attempt an interactive GUI for it. Unfortunately your link came up blank. :/ (If you post another link I’ll add it to your first comment.)

  5. Pingback: Galaxy animation from 2010 | EJRH

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s