Question

I want to compute the Earth position (relative to the sun) and axis rotations for a given date and time. It's ok to assume the Sun is stationary at the 0,0,0 coordinate. Very minor deflections, due to the Moons gravitational pull for example, can also be ignored. Anything accurate within a degree or so is good enough.

Are there any libraries/source/data out there that will help me accomplish this?

Was it helpful?

Solution

The aa-56 code, which can be downloaded from here, includes a solar ephemeris that will probably meet your needs. For high-precision work you'd want something more accurate like JPL's DE421, but there are some inconveniently large tables of coefficients involved, and it's probably extreme overkill if you're happy with 1 degree accuracy.

The Earth's rotation at a given time is given by the Greenwich sidereal time.
Jean Meeus' "Astronomical Algorithms" (a good reference to have for these sorts of calculations!) gives a formula for theta0 (cumulative rotation angle in degrees) in terms of the Julian date JD:

T = (JD - 2451545.0 ) / 36525

theta0 = 280.46061837 + 360.98564736629*(JD-2451545.0) + 
           0.000387933*T*T - T*T*T/38710000.0

theta0 = 0 degrees mod 360 represents the instant when the Greenwich meridian is aligned with right ascension 0:00 in celestial coordinates.

OTHER TIPS

Yes. What you need is an Ephemeris package.

The JPL has an online Ephemeris service that will do the computations for you, so if you are web-capable you can hit that up.

I found a free Ephermeris package too, but it looks like it just hits the JPL site for you. However, there's a link there to download the JPL's database and have it work off of that. So if you want to work offline and don't mind updating your database from the JPL manually every now and then, that might be an option.

In Python, using the ephem library:

>>> import ephem
>>> sun = ephem.Sun()
>>> sun.compute(ephem.now())
>>> sun.hlong, sun.hlat, sun.earth_distance
(69:41:32.6, 0:00:00.2, 0.98602390289306641)

ephem doesn't provide a convenient representation of the Earth as a body, but sun.hlong and sun.hlat give the heliocentric longitude and latitude of the Earth. This could be better documented.

For Earth rotation, maybe you can say what value you're looking for here. (Normally we use the time of day, but I think it's generally clear how to get hold of that!)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top