Ignore:
Timestamp:
Feb 27, 2009, 11:54:09 AM (16 years ago)
Author:
rwilson
Message:

numpy changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/numpy/anuga/coordinate_transforms/test_geo_reference.py

    r6410 r6428  
    503503                        'bad shape did not raise error!')
    504504            os.remove(point_file)
     505
     506    def test_functionality_get_absolute(self):
     507        x0 = 1000.0
     508        y0 = 2000.0
     509        geo = Geo_reference(56, x0, y0)
     510
     511        # iterable points (*not* num.array())
     512        points = ((2,3), (3,1), (5,2))
     513        abs_points = geo.get_absolute(points)
     514        # check we haven't changed 'points' itself
     515        self.failIf(num.alltrue(abs_points == points))
     516        new_points = abs_points.copy()
     517        new_points[:,0] -= x0
     518        new_points[:,1] -= y0
     519        self.failUnless(num.alltrue(new_points == points))
     520
     521        # points in num.array()
     522        points = num.array(((2,3), (3,1), (5,2)), num.float)
     523        abs_points = geo.get_absolute(points)
     524        # check we haven't changed 'points' itself
     525        self.failIf(num.alltrue(abs_points == points))
     526        new_points = abs_points.copy()
     527        new_points[:,0] -= x0
     528        new_points[:,1] -= y0
     529        self.failUnless(num.alltrue(new_points == points))
     530
    505531       
    506532#-------------------------------------------------------------
    507533
    508534if __name__ == "__main__":
    509     suite = unittest.makeSuite(geo_referenceTestCase,'test')
     535    suite = unittest.makeSuite(geo_referenceTestCase, 'test')
     536    #suite = unittest.makeSuite(geo_referenceTestCase, 'test_functionality_get_absolute')
    510537    runner = unittest.TextTestRunner() #verbosity=2)
    511538    runner.run(suite)
Note: See TracChangeset for help on using the changeset viewer.