Ignore:
Timestamp:
Feb 25, 2009, 9:37:22 AM (15 years ago)
Author:
rwilson
Message:

numpy changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/numpy/anuga/utilities/test_polygon.py

    r6360 r6410  
    17031703        assert num.allclose(z, z_ref)
    17041704
     1705    def test_inside_polygon_badtest_1(self):
     1706        '''Test failure found in a larger test in shallow_water.
     1707        (test_get_maximum_inundation in test_data_manager.py (line 10574))
     1708       
     1709        Data below, when fed into:
     1710            indices = inside_polygon(points, polygon)
     1711        returns indices == [], and it shouldn't.
     1712
     1713        However, it works fine here!?!?
     1714        '''
     1715
     1716        polygon = [[50, 1], [99, 1], [99, 49], [50, 49]]
     1717
     1718        points = [[  0.,  0.], [  0., 10.], [  0., 20.], [  0., 30.],
     1719                  [  0., 40.], [  0., 50.], [  5.,  0.], [  5., 10.],
     1720                  [  5., 20.], [  5., 30.], [  5., 40.], [  5., 50.],
     1721                  [ 10.,  0.], [ 10., 10.], [ 10., 20.], [ 10., 30.],
     1722                  [ 10., 40.], [ 10., 50.], [ 15.,  0.], [ 15., 10.],
     1723                  [ 15., 20.], [ 15., 30.], [ 15., 40.], [ 15., 50.],
     1724                  [ 20.,  0.], [ 20., 10.], [ 20., 20.], [ 20., 30.],
     1725                  [ 20., 40.], [ 20., 50.], [ 25.,  0.], [ 25., 10.],
     1726                  [ 25., 20.], [ 25., 30.], [ 25., 40.], [ 25., 50.],
     1727                  [ 30.,  0.], [ 30., 10.], [ 30., 20.], [ 30., 30.],
     1728                  [ 30., 40.], [ 30., 50.], [ 35.,  0.], [ 35., 10.],
     1729                  [ 35., 20.], [ 35., 30.], [ 35., 40.], [ 35., 50.],
     1730                  [ 40.,  0.], [ 40., 10.], [ 40., 20.], [ 40., 30.],
     1731                  [ 40., 40.], [ 40., 50.], [ 45.,  0.], [ 45., 10.],
     1732                  [ 45., 20.], [ 45., 30.], [ 45., 40.], [ 45., 50.],
     1733                  [ 50.,  0.], [ 50., 10.], [ 50., 20.], [ 50., 30.],
     1734                  [ 50., 40.], [ 50., 50.], [ 55.,  0.], [ 55., 10.],
     1735                  [ 55., 20.], [ 55., 30.], [ 55., 40.], [ 55., 50.],
     1736                  [ 60.,  0.], [ 60., 10.], [ 60., 20.], [ 60., 30.],
     1737                  [ 60., 40.], [ 60., 50.], [ 65.,  0.], [ 65., 10.],
     1738                  [ 65., 20.], [ 65., 30.], [ 65., 40.], [ 65., 50.],
     1739                  [ 70.,  0.], [ 70., 10.], [ 70., 20.], [ 70., 30.],
     1740                  [ 70., 40.], [ 70., 50.], [ 75.,  0.], [ 75., 10.],
     1741                  [ 75., 20.], [ 75., 30.], [ 75., 40.], [ 75., 50.],
     1742                  [ 80.,  0.], [ 80., 10.], [ 80., 20.], [ 80., 30.],
     1743                  [ 80., 40.], [ 80., 50.], [ 85.,  0.], [ 85., 10.],
     1744                  [ 85., 20.], [ 85., 30.], [ 85., 40.], [ 85., 50.],
     1745                  [ 90.,  0.], [ 90., 10.], [ 90., 20.], [ 90., 30.],
     1746                  [ 90., 40.], [ 90., 50.], [ 95.,  0.], [ 95., 10.],
     1747                  [ 95., 20.], [ 95., 30.], [ 95., 40.], [ 95., 50.],
     1748                  [100.,  0.], [100., 10.], [100., 20.], [100., 30.],
     1749                  [100., 40.], [100., 50.]]
     1750
     1751        points = num.array(points)
     1752
     1753        indices = inside_polygon(points, polygon)
     1754
     1755
    17051756################################################################################
    17061757
    17071758if __name__ == "__main__":
    17081759    suite = unittest.makeSuite(Test_Polygon,'test')
    1709     #suite = unittest.makeSuite(Test_Polygon,'test_inside_polygon_geospatial')
     1760    #suite = unittest.makeSuite(Test_Polygon,'test_inside_polygon_badtest_1')
    17101761    runner = unittest.TextTestRunner()
    17111762    runner.run(suite)
Note: See TracChangeset for help on using the changeset viewer.