Changeset 2577 for inundation/fit_interpolate/test_interpolate.py
- Timestamp:
- Mar 22, 2006, 5:28:24 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/fit_interpolate/test_interpolate.py
r2563 r2577 22 22 from utilities.numerical_tools import mean 23 23 from data_manager import get_dataobject 24 from geospatial_data.geospatial_data import Geospatial_data 24 25 25 26 def distance(x, y): … … 792 793 raise 'Should raise exception' 793 794 794 795 def BADtest_interpolate_sww(self): 796 """Not a unit test, rather a system test for interpolate_sww 797 This function is obsolete 798 """ 799 800 self.domain.filename = 'datatest' + str(time.time()) 801 self.domain.format = 'sww' 802 self.domain.smooth = True 803 self.domain.reduction = mean 804 805 sww = get_dataobject(self.domain) 806 sww.store_connectivity() 807 sww.store_timestep('stage') 808 self.domain.time = 2. 809 sww.store_timestep('stage') 810 811 #print "self.domain.filename",self.domain.filename 812 interp = interpolate_sww(sww.filename, [0.0, 2.0], 813 [[0,1],[0.5,0.5]], 814 ['stage']) 815 #assert allclose(interp,[0.0,2.0]) 816 817 #Cleanup 818 os.remove(sww.filename) 795 796 def qtest_interpolation_interface(self): 797 a = [-1.0, 0.0] 798 b = [3.0, 4.0] 799 c = [4.0, 1.0] 800 d = [-3.0, 2.0] #3 801 e = [-1.0, -2.0] 802 f = [1.0, -2.0] #5 803 804 vertices = [a, b, c, d,e,f] 805 triangles = [[0,1,3], [1,0,2], [0,4,5], [0,5,2]] #abd bac aef afc 806 807 point_coords = [[-2.0, 2.0], 808 [-1.0, 1.0], 809 [0.0, 2.0], 810 [1.0, 1.0], 811 [2.0, 1.0], 812 [0.0, 0.0], 813 [1.0, 0.0], 814 [0.0, -1.0], 815 [-0.2, -0.5], 816 [-0.9, -1.5], 817 [0.5, -1.9], 818 [999999, 9999999]] 819 geo_data = Geospatial_data(data_points = point_coords) 820 821 interp = Interpolate(vertices, triangles) 822 f = array([linear_function(vertices),2*linear_function(vertices) ]) 823 f = transpose(f) 824 #print "f",f 825 z = interp.interpolate(f, geo_data) 826 #z = interp.interpolate(f, point_coords) 827 answer = [linear_function(point_coords), 828 2*linear_function(point_coords) ] 829 answer = transpose(answer) 830 #print "z",z 831 #print "answer",answer 832 assert allclose(z, answer) 833 819 834 820 835 #------------------------------------------------------------- 821 836 if __name__ == "__main__": 822 suite = unittest.makeSuite(Test_Interpolate,' test')837 suite = unittest.makeSuite(Test_Interpolate,'qtest') 823 838 runner = unittest.TextTestRunner(verbosity=1) 824 839 runner.run(suite)
Note: See TracChangeset
for help on using the changeset viewer.