示例#1
0
    def test_ll2ne_bounds(self):
        """test of ll2ne's bounds"""
        
        from ll2ne import ll2ne #, ne2ll

        northing, easting, zone, h = ll2ne(-90, 0)
        northing, easting, zone, h = ll2ne(90, 0)
        northing, easting, zone, h = ll2ne(0, -180)
        northing, easting, zone, h = ll2ne(0, 180)        
示例#2
0
    def xxxxtest_ne2ll2ne(self):
        """Test conversions back and forward"""        

        from ne2ll import ne2ll
        from ll2ne import ll2ne

        eps = 1.0e-6  #Less accuracy

        #Northings, eastings, zone and hemisphere
        nes = [(6320371.85657, 716174.605757, 55, 'S'),
               (1505230,345745,55,'N'), (1505230,345745,55,'S')] 
        for northing, easting, zone, hemisphere in nes:

            lat, lon = ne2ll(northing, easting, zone, hemisphere)
            northing1, easting1, zone1, hemisphere1 = ll2ne(lat, lon)

            print northing, northing1
            print easting, easting1
            
            assert abs(northing - northing1)/abs(northing) < eps,\
                   "%f %f" %(northing, northing1) 
            assert abs(easting - easting1)/abs(easting) < eps,\
                   "%f %f" %(easting, easting1)             
            assert zone == zone1
            assert hemisphere == hemisphere1
示例#3
0
    def test_ll2ne(self):
        """Basic test of ll2ne"""
        
        from ll2ne import ll2ne #, ne2ll

        lat = -(37.0 + (39.0 + 10.15611/60.0)/60.0)
        lon = (143.0 + (55.0 + 35.383900/60.0)/60.0)

        northing, easting, zone, hemisphere = ll2ne(lat, lon)

        assert abs(northing - 5828674.33975)/abs(northing) < self.eps
        assert abs(easting - 758173.79727)/abs(easting) < self.eps
        assert zone == 54
        assert hemisphere == 'S'        
示例#4
0
    def test_ll2ne2ll(self):
        """Test conversions back and forward"""        

        from ne2ll import ne2ll
        from ll2ne import ll2ne

        eps = 1.0e-6  #Less accuracy
        
        latlons = [(-33.234, 149.32), (53.02,2.23421), (0,0), (40, -50),
                   (-36,0), (-50,-60), (-89.9,0), (-89,-2), (89.9,0),
                   (0, -180), (0, 180)]

        for lat, lon  in latlons:
            northing, easting, zone, hemisphere = ll2ne(lat, lon)            
            lat1, lon1 = ne2ll(northing, easting, zone, hemisphere)
            #print lat, lon, zone, easting, northing, hemisphere, lat1, lon1

            assert abs(lat - lat1) < eps, "%f, %f" %(lat, lat1)
            assert abs(lon - lon1) < eps, "%f, %f" %(lon, lon1)