Navigation.py 文件源码

python
阅读 41 收藏 0 点赞 0 评论 0

项目:PySail-426 作者: j3b4 项目源码 文件源码
def print_lon(lon):  # def stampalon(lon):
    # returns a string in the format xxDegrees,xxMinutes, N/S
    lon_decimal = math.copysign(math.degrees(lon), 1)  # londecimali
    lon_degree = int(lon_decimal)  # longradi
    lon_minutes = (lon_decimal - lon_degree) * 60  # lonprimi
    if lon_minutes > 59.51:
        lon_degree = lon_degree + 1
        lon_minutes = 0
    else:
        if lon_minutes - int(lon_minutes) > 0.51:
            lon_minutes = int(lon_minutes) + 1
        else:
            lon_minutes = int(lon_minutes)
    if lon > 0:
        hemisphere = "W"
    else:
        hemisphere = "E"
    degrees = "%3d" % lon_degree  # gradi
    minutes = "%2d" % lon_minutes
    lon = (degrees.replace(" ", "0") + u"°" + minutes.replace(" ", "0")
           + "'" + hemisphere)
    return lon
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号