示例#1
0
    def test_inverse_meridional_case2(self):
        # Test a few difficult cases that arose during development
        az, baz, _ = LonLatWGS84.inverse(100, 8, -80, 8)
        self.assertAlmostEqual(az, 0.0)
        self.assertAlmostEqual(baz, 0.0)

        az, baz, _ = LonLatWGS84.inverse(-15, 86, 165, 86)
        self.assertAlmostEqual(az, 0.0)
        self.assertAlmostEqual(baz, 0.0)

        az, baz, _ = LonLatWGS84.inverse(-139, -23, 41, -23)
        self.assertAlmostEqual(az, 180.0)
        self.assertAlmostEqual(baz, 180.0)
示例#2
0
    def test_inverse_meridional_case2(self):
        # Test a few difficult cases that arose during development
        az, baz, _ = LonLatWGS84.inverse(100, 8, -80, 8)
        self.assertAlmostEqual(az, 0.0)
        self.assertAlmostEqual(baz, 0.0)

        az, baz, _ = LonLatWGS84.inverse(-15, 86, 165, 86)
        self.assertAlmostEqual(az, 0.0)
        self.assertAlmostEqual(baz, 0.0)

        az, baz, _ = LonLatWGS84.inverse(-139, -23, 41, -23)
        self.assertAlmostEqual(az, 180.0)
        self.assertAlmostEqual(baz, 180.0)
示例#3
0
 def test_forward(self):
     # solution from Karney table 2
     x1, y1, baz = LonLatWGS84.forward(0.0, 40.0, 30.0, 10e6)
     self.assertAlmostEqual(x1, 137.84490004377)
     self.assertAlmostEqual(y1, 41.79331020506)
     self.assertAlmostEqual(baz + 180, 149.09016931807)
     return
示例#4
0
 def test_forward(self):
     # solution from Karney table 2
     x1, y1, baz = LonLatWGS84.forward(0.0, 40.0, 30.0, 10e6)
     self.assertAlmostEqual(x1, 137.84490004377)
     self.assertAlmostEqual(y1, 41.79331020506)
     self.assertAlmostEqual(baz+180, 149.09016931807)
     return
示例#5
0
    def test_inverse(self):
        phi1 = -30
        phi2 = 29.9
        lambda12 = 179.8

        az, backaz, dist = LonLatWGS84.inverse(0.0, phi1, lambda12, phi2)
        self.assertAlmostEqual(az, 161.890524, places=5)
        self.assertAlmostEqual(dist, 19989832.827610, places=3)  # accurate to mm
        return
示例#6
0
    def test_inverse(self):
        phi1 = -30
        phi2 = 29.9
        lambda12 = 179.8

        az, backaz, dist = LonLatWGS84.inverse(0.0, phi1, lambda12, phi2)
        self.assertAlmostEqual(az, 161.890524, places=5)
        self.assertAlmostEqual(dist, 19989832.827610,
                               places=3)  # accurate to mm
        return
示例#7
0
    def test_inverse_fuzz(self):
        def nl(x):
            return (round(x, 8)+180) % 360 - 180
        curpath = os.path.split(os.path.realpath(__file__))[0]
        datapath = os.path.join(curpath, "data", "geodetic_data.dat")
        data = np.fromfile(datapath).reshape([10000, 7])

        for i in range(data.shape[0]):
            x1, x2, y1, y2, azd, bazd, dd = data[i,:]
            az, baz, d = LonLatWGS84.inverse(x1, y1, x2, y2)
            self.assertAlmostEqual(nl(az), nl(azd))
            self.assertAlmostEqual(nl(baz), nl(bazd))
            self.assertAlmostEqual(d, dd, places=2)  # expects cm accuracy
        return
示例#8
0
    def test_forward_fuzz(self):
        def nl(x):
            return (round(x, 8)+180) % 360 - 180
        curpath = os.path.split(os.path.realpath(__file__))[0]
        datapath = os.path.join(curpath, "data", "geodetic_data.dat")
        data = np.fromfile(datapath).reshape([10000, 7])

        for i in range(data.shape[0]):
            x1, x2, y1, y2, azd, bazd, dd = data[i,:]
            x, y, baz = LonLatWGS84.forward(x1, y1, azd, dd)
            self.assertAlmostEqual(nl(x), nl(x2))
            self.assertAlmostEqual(nl(y), nl(y2))
            self.assertAlmostEqual(nl(baz), nl(bazd))
        return
示例#9
0
    def test_inverse_fuzz(self):
        def nl(x):
            return (round(x, 8) + 180) % 360 - 180

        curpath = os.path.split(os.path.realpath(__file__))[0]
        datapath = os.path.join(curpath, "data", "geodetic_data.dat")
        data = np.fromfile(datapath).reshape([10000, 7])

        for i in range(data.shape[0]):
            x1, x2, y1, y2, azd, bazd, dd = data[i, :]
            az, baz, d = LonLatWGS84.inverse(x1, y1, x2, y2)
            self.assertAlmostEqual(nl(az), nl(azd))
            self.assertAlmostEqual(nl(baz), nl(bazd))
            self.assertAlmostEqual(d, dd, places=2)  # expects cm accuracy
        return
示例#10
0
    def test_forward_fuzz(self):
        def nl(x):
            return (round(x, 8) + 180) % 360 - 180

        curpath = os.path.split(os.path.realpath(__file__))[0]
        datapath = os.path.join(curpath, "data", "geodetic_data.dat")
        data = np.fromfile(datapath).reshape([10000, 7])

        for i in range(data.shape[0]):
            x1, x2, y1, y2, azd, bazd, dd = data[i, :]
            x, y, baz = LonLatWGS84.forward(x1, y1, azd, dd)
            self.assertAlmostEqual(nl(x), nl(x2))
            self.assertAlmostEqual(nl(y), nl(y2))
            self.assertAlmostEqual(nl(baz), nl(bazd))
        return