Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pyephem compute elevation angle

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.

enter image description here

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?

like image 290
SebML Avatar asked Oct 31 '22 18:10

SebML


1 Answers

If you will ask the satellite for its altitude angle using .alt then you should get the value that, in your diagram, is called “elevation”:

print 'angle above the horizon:', satellite.alt

The altitude alt is one of a pair of coordinates, the other of which is the az azimuth angle. Together the altitude and azimuth tell an observer where to look in the sky above them. Some telescopes use this system and are called “altazimuth” telescopes.

The confusion here is that the Earth-satellite community of engineers chose the word “elevation” for how high in degrees a satellite was above the horizon, maybe without knowing that over in science, astronomers already had a name “altitude” for that angle.

For more details on astronomic altitude and azimuth, see:

https://en.wikipedia.org/wiki/Horizontal_coordinate_system

like image 103
Brandon Rhodes Avatar answered Nov 15 '22 05:11

Brandon Rhodes