开发者

Entering precise degrees into python

What is the standard way to enter degrees into python? My total station gives degrees in degree-minute-seco开发者_JAVA百科nd format. I could write a function to convert this to a decimal degree but I would like to know if there is a common way to do this that I am unaware of.

-Chris


Chris: not likely.

Since you need radians, anyway, this should od the trick:

import math
def radians_from_triple(deg, min=0, sec=0):
    return math.radians(deg + min * 60 ** -1 + sec * 60 ** -2)


Python uses radians, as a float.

There is no specific "angle" type, although you can write one yourself as needed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜