- Timestamp:
- Sep 5, 2007, 4:42:58 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/shallow_water/test_data_manager.py
r4701 r4704 256 256 os.remove(sww.filename) 257 257 258 def NOtest_sww_extrema(self):258 def test_sww_extrema(self): 259 259 """Test that extrema of quantities can be retrieved at every vertex 260 260 Extrema are updated at every *internal* timestep … … 263 263 domain = self.domain 264 264 265 domain.set_name(' datatest' + str(id(self)))265 domain.set_name('extrema_test' + str(id(self))) 266 266 domain.format = 'sww' 267 267 domain.smooth = True … … 271 271 assert domain.monitor_time_interval is None 272 272 273 domain.set_quantities_to_be_monitored(['stage', 'ymomentum']) 274 275 assert len(domain.quantities_to_be_monitored) == 2 276 assert domain.quantities_to_be_monitored[0] == 'stage' 277 assert domain.quantities_to_be_monitored[1] == 'ymomentum' 273 domain.set_quantities_to_be_monitored(['xmomentum', 274 'ymomentum', 275 'stage-elevation']) 276 277 assert len(domain.quantities_to_be_monitored) == 3 278 assert domain.quantities_to_be_monitored.has_key('stage-elevation') 279 assert domain.quantities_to_be_monitored.has_key('xmomentum') 280 assert domain.quantities_to_be_monitored.has_key('ymomentum') 278 281 assert domain.monitor_polygon is None 279 282 assert domain.monitor_time_interval is None … … 282 285 283 286 for t in domain.evolve(yieldstep = 1, finaltime = 1): 284 print domain.timestepping_statistics() 285 print domain.quantity_statistics() 287 pass 288 #print domain.timestepping_statistics() 289 #print domain.quantity_statistics(precision = '%.8f') 286 290 287 291 … … 290 294 291 295 # Get the variables 292 extrema = fid.variables['stage_extrema'][:] 293 assert allclose(range, []) 294 295 extrema = fid.variables['xmomentum_extrema'][:] 296 assert allclose(range,[]) 297 298 extrema = fid.variables['ymomentum_extrema'][:] 299 assert allclose(range,[]) 296 extrema = fid.variables['stage-elevation:extrema'][:] 297 assert allclose(extrema, [0.00, 0.30]) 298 299 loc = fid.variables['stage-elevation:min_location'][:] 300 assert allclose(loc, [0.16666667, 0.33333333]) 301 302 loc = fid.variables['stage-elevation:max_location'][:] 303 assert allclose(loc, [0.8333333, 0.16666667]) 304 305 time = fid.variables['stage-elevation:max_time'][:] 306 assert allclose(time, 0.0) 307 308 extrema = fid.variables['xmomentum:extrema'][:] 309 assert allclose(extrema,[-0.06062178, 0.47886313]) 310 311 extrema = fid.variables['ymomentum:extrema'][:] 312 assert allclose(extrema,[0.00, 0.06241221]) 300 313 301 314 … … 6723 6736 number_of_points = len(points_utm) 6724 6737 sww = Write_sww() 6725 sww. header(outfile, times, number_of_volumes,6738 sww.store_header(outfile, times, number_of_volumes, 6726 6739 number_of_points, description='fully sick testing', 6727 6728 sww. triangulation(outfile, points_utm, volumes,6729 6730 6740 verbose=self.verbose) 6741 sww.store_triangulation(outfile, points_utm, volumes, 6742 elevation, new_origin=new_origin, 6743 verbose=self.verbose) 6731 6744 outfile.close() 6732 6745 fid = NetCDFFile(filename) … … 6755 6768 number_of_points = len(points_utm) 6756 6769 sww = Write_sww() 6757 sww. header(outfile, times, number_of_volumes,6770 sww.store_header(outfile, times, number_of_volumes, 6758 6771 number_of_points, description='fully sick testing', 6759 6772 verbose=self.verbose) 6760 sww. triangulation(outfile, points_utm, volumes,6761 6762 6773 sww.store_triangulation(outfile, points_utm, volumes, 6774 elevation, new_origin=new_origin, 6775 verbose=self.verbose) 6763 6776 outfile.close() 6764 6777 fid = NetCDFFile(filename) … … 6791 6804 number_of_points = len(points_utm) 6792 6805 sww = Write_sww() 6793 sww. header(outfile, times, number_of_volumes,6806 sww.store_header(outfile, times, number_of_volumes, 6794 6807 number_of_points, description='fully sick testing', 6795 6808 verbose=self.verbose) 6796 sww. triangulation(outfile, points_utm, volumes,6797 6798 6809 sww.store_triangulation(outfile, points_utm, volumes, 6810 elevation, new_origin=new_origin, 6811 verbose=self.verbose) 6799 6812 outfile.close() 6800 6813 fid = NetCDFFile(filename) … … 6830 6843 number_of_points = len(points_utm) 6831 6844 sww = Write_sww() 6832 sww. header(outfile, times, number_of_volumes,6845 sww.store_header(outfile, times, number_of_volumes, 6833 6846 number_of_points, description='fully sick testing', 6834 6847 verbose=self.verbose) 6835 sww. triangulation(outfile, points_utm, volumes,6836 6837 6838 6848 sww.store_triangulation(outfile, points_utm, volumes, 6849 elevation, new_origin=new_origin, 6850 points_georeference=points_georeference, 6851 verbose=self.verbose) 6839 6852 outfile.close() 6840 6853 fid = NetCDFFile(filename) … … 6866 6879 number_of_points = len(points_utm) 6867 6880 sww = Write_sww() 6868 sww. header(outfile, times, number_of_volumes,6881 sww.store_header(outfile, times, number_of_volumes, 6869 6882 number_of_points, description='fully sick testing', 6870 6883 verbose=self.verbose) 6871 sww. triangulation(outfile, points_utm, volumes,6872 6873 6874 6884 sww.store_triangulation(outfile, points_utm, volumes, 6885 elevation, new_origin=new_origin, 6886 points_georeference=points_georeference, 6887 verbose=self.verbose) 6875 6888 outfile.close() 6876 6889 fid = NetCDFFile(filename) … … 7281 7294 #suite = unittest.makeSuite(Test_Data_Manager,'test_sww_header') 7282 7295 #suite = unittest.makeSuite(Test_Data_Manager,'test_export_grid_parallel') 7283 #suite = unittest.makeSuite(Test_Data_Manager,'t')7284 7296 suite = unittest.makeSuite(Test_Data_Manager,'test') 7297 #suite = unittest.makeSuite(Test_Data_Manager,'test_sww_extrema') 7285 7298 7286 7299
Note: See TracChangeset
for help on using the changeset viewer.