示例#1
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
示例#2
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
示例#3
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
示例#4
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