Changeset 3529 for anuga_core/source/anuga/pyvolution/test_data_manager.py
- Timestamp:
- Aug 25, 2006, 11:19:49 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/pyvolution/test_data_manager.py
r3514 r3529 459 459 460 460 461 462 def test_sww_DSG(self): 461 def test_sww_minimum_allowed_depth(self): 462 """Test that sww information can be written correctly 463 multiple timesteps using a different reduction operator (min) 464 """ 465 466 import time, os 467 from Numeric import array, zeros, allclose, Float, concatenate 468 from Scientific.IO.NetCDF import NetCDFFile 469 470 self.domain.filename = 'datatest' + str(id(self)) 471 self.domain.format = 'sww' 472 self.domain.smooth = True 473 self.domain.reduction = min 474 self.domain.minimum_allowed_depth = 100 475 476 sww = get_dataobject(self.domain) 477 sww.store_connectivity() 478 sww.store_timestep('stage') 479 480 self.domain.evolve_to_end(finaltime = 0.01) 481 sww.store_timestep('stage') 482 483 484 #Check contents 485 #Get NetCDF 486 fid = NetCDFFile(sww.filename, 'r') 487 488 489 # Get the variables 490 x = fid.variables['x'] 491 y = fid.variables['y'] 492 z = fid.variables['elevation'] 493 time = fid.variables['time'] 494 stage = fid.variables['stage'] 495 496 #Check values 497 Q = self.domain.quantities['stage'] 498 Q0 = Q.vertex_values[:,0] 499 Q1 = Q.vertex_values[:,1] 500 Q2 = Q.vertex_values[:,2] 501 502 A = stage[1,:] 503 assert allclose(stage[1,:], z[:]) 504 fid.close() 505 506 #Cleanup 507 os.remove(sww.filename) 508 509 510 def Not_a_test_sww_DSG(self): 463 511 """Not a test, rather a look at the sww format 464 512 """ … … 4944 4992 #------------------------------------------------------------- 4945 4993 if __name__ == "__main__": 4946 #suite = unittest.makeSuite(Test_Data_Manager,'test_ exposure_csv_loading_x_y2')4994 #suite = unittest.makeSuite(Test_Data_Manager,'test_sww_minimum_allowed_depth') 4947 4995 suite = unittest.makeSuite(Test_Data_Manager,'test') 4948 4996 runner = unittest.TextTestRunner()
Note: See TracChangeset
for help on using the changeset viewer.