- Timestamp:
- Nov 26, 2004, 12:23:25 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/test_interpolate_sww.py
r628 r631 159 159 160 160 #print "self.domain.filename",self.domain.filename 161 interp = Interpolate_sww(sww.filename )161 interp = Interpolate_sww(sww.filename, 'height') 162 162 163 163 assert allclose(interp.time,[0.0,2.0]) 164 answer = [ 0.15, 0.1, 0., -0.3, -0.35, -0.4, -0.7, -0.8, -0.850] 164 165 #answer = [ 0.15, 0.1, 0., -0.3, -0.35, -0.4, -0.7, -0.8, -0.850] 165 166 #print "answer",answer 166 167 #print interp.stage[0] 167 stage_t = transpose(interp.stage)168 assert allclose(stage_t[0], answer)169 assert allclose(stage_t[1],stage_t[0])168 #stage_t = transpose(interp.stage) 169 #assert allclose(stage_t[0], answer) 170 #assert allclose(stage_t[1],stage_t[0]) 170 171 171 172 # create an .xya file … … 177 178 interp.interpolate_xya(point_file) 178 179 179 180 180 answer = [[0.08, 0.08], [0.02, 0.02], [0.14, 0.14], [.08,.08]] 181 181 #print "answer",answer 182 assert allclose(interp. depth,answer)182 assert allclose(interp.interpolated_quantity,answer) 183 183 184 184 # create an output .xya file … … 190 190 191 191 assert allclose(interp.point_coordinates, xya_dict['pointlist']) 192 assert allclose(interp. depth,192 assert allclose(interp.interpolated_quantity, 193 193 xya_dict['pointattributelist'] ) 194 194 … … 198 198 time_list = [] 199 199 200 # this is if titles start with x,y 201 #answer = string_list.pop(0) 202 #self.failUnless( answer == 'x', 'Title is wrong!') 203 #self.failUnless( string_list.pop(0) == 'y', 'Title is wrong!') 204 205 for time in string_list: 206 time_list.append(float(time)) 207 #print "interp.time", interp.time 208 #print "time_list", time_list 209 assert allclose(interp.time, 210 time_list) 211 212 200 # Try another quantity 201 interp = Interpolate_sww(sww.filename, 'stage') 202 interp.interpolate_xya(point_file) 203 204 answer = [[0.08, 0.08], [0.02, 0.02], [0.14, 0.14], [-.32,-.32]] 205 #print "answer",answer 206 assert allclose(interp.interpolated_quantity,answer) 207 208 209 # look at error catching 210 try: 211 interp = Interpolate_sww(sww.filename, 'funky!') 212 except KeyError: 213 pass 214 else: 215 self.failUnless(0==1, 216 'bad key did not raise an error!') 217 218 # look at error catching 219 try: 220 interp = Interpolate_sww(sww.filename, 'z') 221 except KeyError: 222 pass 223 else: 224 self.failUnless(0==1, 225 'bad key did not raise an error!') 226 213 227 #Cleanup 214 228 os.remove(sww.filename)
Note: See TracChangeset
for help on using the changeset viewer.