I am trying to get the distance of the Earth and the correct ascent (relative to my observation point on Earth) of a satellite that does not revolve around the Earth, but pyEphem does not return the same properties as other solar bodies.
With Ganymede (the largest moon of Jupiter), for example:
import math, ephem Observer = ephem.city('London') Observer.date = '2013-04-23' Observer.pressure, Observer.elevation = 0, 100 moonGanymede = ephem.Ganymede(Observer) print math.cos(moonGanymede.ra)
I get this error:
AttributeError: 'Ganymede' object has no attribute 'earth_distance'
The ra attribute exists, but does it apply to my Observer or to Jupiter?
This seems to be relative to Observer , since if I change the location, the value will also change.
I read the documentation and I know that these properties are not defined for the moons, but I have no idea how to calculate these relative to the Earth, taking into account the additional specific properties of the bodies of the moon:
On the planetary moons are also installed:
The position of the moon relative to the planet (measured in the radii of the planet)
x — offset +east or –west y — offset +south or –north z — offset +front or –behind
Doing:
print moonGanymede.x, moonGanymede.y, moonGanymede.z
Outputs:
-14.8928060532 1.52614057064 -0.37974858284
Since Jupiter has an average radius of 69173 kilometers, these values are translated into:
moonGanymede.x = 1030200 kilometers (west) moonGanymede.y = 105570 kilometers (south) moonGanymede.z = 26268 kilometers (behind)
Given that I know the distance and right ascension of Jupiter relative to Observer , how can I calculate the distance and direct ascension of moonGanymede (also relative to Observer )
I am using pyEphem 3.7.5.1 (since Python 2.7).