Search code examples
pyephem

PyEphem Body location in degrees


I am trying to figure out how to use pyephem to get the degrees (alt and az I think) of a body or satellite. I'm going to pass that information to a motor control, so I really would like the information in 360 degree from north if possible. Or more information on how things like this are calculated would be handy as well.

Any help would be wonderful. Thanks


Solution

  • You should be able to get floating point numbers in degrees with:

    sat.alt / ephem.degree
    sat.az / ephem.degree
    

    Because you are doing math with the two values, they are made available to these expressions in radians, and the value ephem.degree is one degree of arc but expressed in radians — so dividing by that value turns your radian measure into degrees.