I would like to compute easily the elevation angle of a satellite in python with the library PyEphem in function of a particular observer. This matter is really new for me so I'm using the picture below to be sure we are talking about the same thing.
In a few words, I have to compute passes of a satellite based on a TLE for different observers because they have to communicate with. But to be sure they would be able to communicate with the satellite they could specify the min elevation angle they want.
Till now, I'm able to compute next passes of the satellite, elevation (in meters) of the satellite and the distance between the satellite and the observer here is my code (I know that I'm not computing the distance at the beginng of the next pass but just from second to second):
#satellite
satellite = ephem.readtle(str1, str2, str3)
#observer
guy = ephem.Observer()
guy.lon, guy.lat = str(long), str(lat)
guy.date = datetime.datetime.now()
#next passes
next_pass = guy.next_pass(satellite)
print ("NEXT PASS: ", next_pass)
nb_passes = 250
previous_pass = next_pass
for i in range(0, nb_passes):
#take satelite downset + 1 second and compute next pass
guy.date = previous_pass[4].datetime() + datetime.timedelta(0, 1)
np = guy.next_pass(satellite)
print np
#compute the satellite.range at the beginning of the pass
guy.date = np[0].datetime()
satellite.compute(guy)
#elevation in meter
print 'elevation satellite: ', satellite.elevation
print 'distance staletlite to guy: ', satellite.range
print 'elev guy: ', guy.elev
print 'elevation guy: ', guy.elevation
previous_pass = np
Is there something in PyEphem to compute the Elevation angle ? (I have read the documentaton (not all) but I did not find it)
On a 2d projection it should be easy to compute it with the sine because we have right-angled triangle with a known opposite side (elevation of satellite) and a known hypotenuse (distance between the observer and the satellite at the begining of the pass). But we are on 3d, so it's most complicated.
Do you have an easy way to compute it?