Changeset 4920


Ignore:
Timestamp:
Jan 9, 2008, 2:25:43 PM (16 years ago)
Author:
nick
Message:

added one more test for split in geospatial_data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/geospatial_data/test_geospatial_data.py

    r4816 r4920  
    18201820        A = G1.get_attributes()
    18211821        assert allclose(A,[24, 18, 17, 11, 8])
     1822       
     1823    def test_split1(self):
     1824        """test if the results from spilt are disjoin sets"""
     1825        from RandomArray import randint,seed
     1826        seed(100,100)
     1827        a_points = randint(0,999999,(10,2))
     1828        points = a_points.tolist()
     1829#        print points
     1830
     1831        G = Geospatial_data(points)
     1832
     1833        factor = 0.1
     1834
     1835        #will return G1 with 10% of points and G2 with 90%
     1836        G1, G2  = G.split(factor,100)
     1837       
     1838#        print 'G1',G1
     1839        assert allclose(len(G), len(G1)+len(G2))
     1840        assert allclose(round(len(G)*factor), len(G1))
     1841
     1842        P = G1.get_data_points(absolute=False)
     1843        assert allclose(P, [[982420.,28233.]])
     1844
    18221845 
    18231846    def test_find_optimal_smoothing_parameter(self):
     
    19391962    #suite = unittest.makeSuite(Test_Geospatial_data, 'test_write_csv_attributes_lat_long')
    19401963#    suite = unittest.makeSuite(Test_Geospatial_data, 'test_find_optimal_smoothing_parameter')
    1941 #    suite = unittest.makeSuite(Test_Geospatial_data, 'test_split')
     1964#    suite = unittest.makeSuite(Test_Geospatial_data, 'test_split1')
    19421965    suite = unittest.makeSuite(Test_Geospatial_data, 'test')
    19431966    runner = unittest.TextTestRunner() #verbosity=2)
Note: See TracChangeset for help on using the changeset viewer.