JPL Horizons to .xyz converter?

Post requests, images, descriptions and reports about work in progress here.
Topic author
BrianJ
Posts: 63
Joined: 17.07.2008
With us: 16 years 8 months

JPL Horizons to .xyz converter?

Post #1by BrianJ » 14.05.2009, 12:06

Hello :-)
is there a utility that can convert the JPL Horizons ephemeris vectors to Celestia's .xyz format?

This is what I get from Horizons web interface:

Code: Select all

2454966.069444444 = A.D. 2009-May-14 13:40:00.0000 (CT)
  -3.267756198986785E+03  6.975492039017916E+03 -3.469745528477056E+02
2454966.194444444 = A.D. 2009-May-14 16:40:00.0000 (CT)
  -4.630887132870568E+04 -2.866735592063210E+04 -4.792739940896789E+03
2454966.319444444 = A.D. 2009-May-14 19:40:00.0000 (CT)
  -6.619888531558611E+04 -5.745088798943103E+04 -6.834501017403117E+03

So I need to get rid of the " = A.D. 2009 etc.etc. " part and put the Julian date and vectors on the same line.

I've googled and searched but can't find anything that looks like it'll do this.
Can anyone point me in the right direction? I don't really fancy having to manually edit 3zillion lines of text!

Many thanks,
Brian

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 7 months
Location: NY, USA

Re: JPL Horizons to .xyz converter?

Post #2by selden » 14.05.2009, 13:36

I don't know of any. Sorry.

You need to delete everything on the same line which starts witn an =
loop (search for =, backspace 1 character, delete to end-of-line)

This is easy to do with an editor like emacs (which is what I use).
If your favorite text editor includes a macro capability, it should be possible to use that, too.
Selden

Topic author
BrianJ
Posts: 63
Joined: 17.07.2008
With us: 16 years 8 months

Re: JPL Horizons to .xyz converter?

Post #3by BrianJ » 14.05.2009, 14:25

Thanks Selden.
My knowledge of text editors is zilch, but that doesn't sound too hard to figure out. I suspect one of my Open Office apps will do the job.

Thought I'd try my hand at making an add-on for Celestia from scratch - so expect a few more newbie questions from me in the near future!

All the best,
Brian

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 23
With us: 23 years
Location: Hamburg, Germany

Re: JPL Horizons to .xyz converter?

Post #4by t00fri » 14.05.2009, 17:12

A little Perl script...

Fridger
Image

Topic author
BrianJ
Posts: 63
Joined: 17.07.2008
With us: 16 years 8 months

Re: JPL Horizons to .xyz converter?

Post #5by BrianJ » 14.05.2009, 17:46

t00fri wrote:A little Perl script...

Fridger
Umm..err, OK, thanks (?) :-)

Anyway, here's how I did it (for the benefit of other folks who are somewhat challenged in the text-editor-macro-programming dept.) using just the Microsoft Works apps that come packaged with XP.

The secret is to select the Comma-Separated-Variables (CSV) format in the "tables" options of Horizons. Save the ephemeris as a .txt and get rid of all the stuff at the top and bottom that isn't the date and x,y,z vectors that you want.

Then you can open it with the "Works Spreadsheet" and just delete the second column (which contains all the A.D. 2009-etc.etc. entries that you want to get rid of). Then save it in .csv format.

Then open it with "Works Word Processor" and use the find-and-replace function to replace all the commas [,] with a space and a comma [ ,] (just replacing the comma with a space doesn't work).

Then replace all the commas with a space (that just deletes all the commas).

That's it. Not the most efficient way of doing it probably, but it works for me ;-)

All the best,
Brian


Return to “Add-on development”