View Single Post
  #81 (permalink)  
Old 29-April-2008, 12:07 PM
Carl_Smith Carl_Smith is offline
Junior Member
 
Join Date: Jul 2005
Location: The land of Oz
Posts: 76
Default Crash course in using NASA JPL Horizons Ephemeris for Ray

Point your browser at:

http://ssd.jpl.nasa.gov/horizons.cgi

The content in the page that opens should look something like this:

http://plasmaresources.com/ozwx/SSB/...s/Settings.jpg

The required settings are shown above (click the "change" links to make your settings) - notes follow.

===============================================

Ephemeris Type [change] : VECTORS

http://plasmaresources.com/ozwx/SSB/...TypeVector.jpg

Click radio button beside "Vector Table", click "Use Selection Above".

This setting ouputs the results as cartesian state vectors (i.e. X, Y, Z relative to the reference plane) - you will need to convert them to spherical coordinates (lon, lat, and distance) - formulae below.


===============================================

Target Body [change] : Solar System Barycenter [SSB] [0]

http://plasmaresources.com/ozwx/SSB/...getBodySSB.jpg
Enter "0" (i.e. zero), set popup menu to "Major bodies only (planets, satellites, etc.)", click "Search".

===============================================

Coordinate Origin [change] : Sun (body center) [500@10]

[url]http://plasmaresources.com/ozwx/SSB/ephemerides/UsingHorizons/CoordinateOriginSun.jpg[url]

Enter "@sun", click "Search".

===============================================

Time Span [change] : Start=1604-12-25, Stop=1848-12-25, Step=1 d

http://plasmaresources.com/ozwx/SSB/...s/TimeSpan.jpg

Enter your time settings, click "Use Specified Times".

Note that there is a limit to the number of lines of output Horizons can generate in one session - if you exceed it, you will find out when you try to generate the ephemeris.

===============================================

Table Settings [change] : output units=KM-S; quantities code=1; reference plane=BODY EQUATOR; CSV format=YES;

http://plasmaresources.com/ozwx/SSB/...leSettings.jpg

Closely examine the settings here and do exactly the same (you can experiment later), then click the "Use Settings Above" when done.

===============================================

When you return to the main page it should look like this:

http://plasmaresources.com/ozwx/SSB/...s/Settings.jpg

Click "Generate Ephemeris".

===============================================

Wait for several minutes while Horizons does it's thing - in good time your results will display:

http://plasmaresources.com/ozwx/SSB/...ns/Results.jpg

===============================================

Here are the the formulae for converting cartesian coordinates (x, y, z) to spherical coordinates (longitude, latitude, radial_distance) in the same reference plane, pasted here as THINK Pascal fragments:

radial_distance := sqrt(x * x + y * y + z * z);

longitude := arcTan2(y, x);

latitude := arcSin(z / radial_distance);
or (high latitude case):
latitude := arcTan2(z, sqrt(x * x + y * y));

Notes:
In some spreadsheets the ATAN2 function has y and x order reversed to that shown here, i.e. =ATAN2(X,Y)

In some program languages including THINK Pascal (TP) you need to write the arcTan2 and arcSin functions first - here they are in THINK Pascal:

Code:
	const
		kHalfPi = 1.57079632679489661923;
		kPi = 3.14159265358979323846;
		k2Pi = 6.28318530717958647692;
		kNearZero = 1e-20;
		
	var
		gErrorFlag: boolean;
		gErrorText: string;
		
	function arcTan2 (y, x: extended): extended;
	begin
		gErrorFlag := false;
		gErrorText := '';
		if abs(x) < kNearZero then
			if abs(y) < kNearZero then
				begin
					gErrorFlag := true;
					gErrorText := 'Error: arcTan2(0,0): check source code';
					arcTan2 := 0.0;
				end
			else if y > 0.0 then
				arcTan2 := kHalfPi
			else
				arcTan2 := -kHalfPi
		else if x > 0.0 then
			arcTan2 := arcTan(y / x)
		else if x < 0.0 then
			if y >= 0.0 then
				arcTan2 := arcTan(y / x) + kPi
			else
				arcTan2 := arcTan(y / x) - kPi;
	end;
	
	
	function arcSin (x: extended): extended;
	begin
		if x >= 1.0 then
			arcSin := kHalfPi
		else if x <= -1.0 then
			arcSin := -kHalfPi
		else if abs(x) < kNearZero then
			arcSin := 0.0
		else
			arcSin := arctan(x / sqrt(1.0 - x * x));
	end;
===============================================

Note from moderator: please just use links. Many of our members use dial-up.
__________________
Carl Smith
The land of Oz

Last edited by Tinaa; 01-May-2008 at 12:05 PM.. Reason: remove image tags