1

I have the satellite longitude, latitude and altitude. Then I have the Ra&Decl of and distant object. I need to know the angular distance between the object and the moon/sun at a given time.

import ephem
sun = ephem.Sun()
scraft = ephem.Observer()
scraft.lon = lon
scraft.lat = lat
scraft.elevation = altit
scraft.date = time-15019.5 # my time is in MJD
sun.compute(scraft)
print float(sun.dec), float(sun.ra)        

Is this the correct approach? is there a way to check the result? (another tool with a web interface, where I could type in the numbers for few cases and see if there is difference)

Cœur
  • 37,241
  • 25
  • 195
  • 267
Asen Christov
  • 848
  • 6
  • 21

1 Answers1

2

You will probably want to create a fixed object to represent the position of the distant object, and then ask for the separation between its position when viewed from the satellite and the position of the sun:

f = ephem.FixedBody()
f._ra = '1:23:45.0'
f._dec = '6:78:90.0'
f.compute(scraft.date)
print ephem.separation(sun, f), 'degrees'
print float(ephem.separation(sun, f)), 'radians'
Brandon Rhodes
  • 83,755
  • 16
  • 106
  • 147