pyPPPETM_double.py 文件源码

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

项目:Parallel.GAMIT 作者: demiangomez 项目源码 文件源码
def distance(self, lon1, lat1, lon2, lat2):
        """
        Calculate the great circle distance between two points
        on the earth (specified in decimal degrees)
        """

        # convert decimal degrees to radians
        lon1 = lon1*pi/180
        lat1 = lat1*pi/180
        lon2 = lon2*pi/180
        lat2 = lat2*pi/180
        # haversine formula
        dlon = lon2 - lon1
        dlat = lat2 - lat1
        a = numpy.sin(dlat/2)**2 + numpy.cos(lat1) * numpy.cos(lat2) * numpy.sin(dlon/2)**2
        c = 2 * numpy.arcsin(numpy.sqrt(a))
        km = 6371 * c
        return km
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号