Changeset 4415
- Timestamp:
- Apr 23, 2007, 4:24:24 PM (18 years ago)
- Location:
- anuga_core/source/anuga
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/shallow_water/test_data_manager.py
r4414 r4415 645 645 convert_dem_from_ascii2netcdf(root) 646 646 dem2pts(root, easting_min=2002.0, easting_max=2007.0, 647 northing_min=3003.0, northing_max=3006.0) 647 northing_min=3003.0, northing_max=3006.0, 648 verbose=self.verbose) 648 649 649 650 #Check contents … … 765 766 convert_dem_from_ascii2netcdf(root) 766 767 dem2pts(root, easting_min=2002.0, easting_max=2007.0, 767 northing_min=3003.0, northing_max=3006.0) 768 northing_min=3003.0, northing_max=3006.0, 769 verbose=self.verbose) 768 770 769 771 #Check contents … … 895 897 convert_dem_from_ascii2netcdf(root) 896 898 dem2pts(root, easting_min=2002.0, easting_max=2007.0, 897 northing_min=3003.0, northing_max=3006.0) 899 northing_min=3003.0, northing_max=3006.0, 900 verbose=self.verbose) 898 901 899 902 #Check contents … … 1312 1315 quantity = 'elevation', 1313 1316 cellsize = cellsize, 1314 verbose = False,1317 verbose = self.verbose, 1315 1318 format = 'asc') 1316 1319 … … 1500 1503 northing_min = 6189050, 1501 1504 northing_max = 6189100, 1502 verbose = False,1505 verbose = self.verbose, 1503 1506 format = 'asc') 1504 1507 … … 1643 1646 cellsize = cellsize, 1644 1647 reduction = min, 1645 format = 'asc') 1648 format = 'asc', 1649 verbose=self.verbose) 1646 1650 1647 1651 … … 1755 1759 reduction = min, 1756 1760 format = 'asc', 1757 verbose = False)1761 verbose = self.verbose) 1758 1762 1759 1763 … … 1904 1908 quantity = 'elevation', 1905 1909 cellsize = cellsize, 1906 verbose = False,1910 verbose = self.verbose, 1907 1911 format = 'asc') 1908 1912 … … 2011 2015 cellsize = cellsize, 2012 2016 NODATA_value = NODATA_value, 2013 verbose = False,2017 verbose = self.verbose, 2014 2018 format = 'ers') 2015 2019 … … 2110 2114 data_points = points, 2111 2115 NODATA_value = NODATA_value, 2112 verbose = False)2116 verbose = self.verbose) 2113 2117 ref_point_values = elevation 2114 2118 point_values = Geospatial_data(ptsfile).get_attributes() … … 2126 2130 data_points = points, 2127 2131 NODATA_value = NODATA_value, 2128 verbose = False)2132 verbose = self.verbose) 2129 2133 ref_point_values = [-0.5, -0.5, -1, -1, -1, -1, -1.5, -1.5] #At centroids 2130 2134 … … 2175 2179 #ferret2sww('small', verbose=False, 2176 2180 # origin = (56, 0, 0)) 2177 ferret2sww(self.test_MOST_file, verbose= False,2181 ferret2sww(self.test_MOST_file, verbose=self.verbose, 2178 2182 origin = (56, 0, 0)) 2179 2183 … … 2247 2251 2248 2252 #Call conversion (with zero origin) 2249 ferret2sww(self.test_MOST_file, verbose= False,2253 ferret2sww(self.test_MOST_file, verbose=self.verbose, 2250 2254 origin = (56, 0, 0)) 2251 2255 … … 2292 2296 2293 2297 #Call conversion (with zero origin) 2294 #ferret2sww('small', verbose= False,2298 #ferret2sww('small', verbose=self.verbose, 2295 2299 # origin = (56, 0, 0)) 2296 ferret2sww(self.test_MOST_file, verbose= False,2300 ferret2sww(self.test_MOST_file, verbose=self.verbose, 2297 2301 origin = (56, 0, 0), minlat=-34.5, maxlat=-34) 2298 2302 … … 2482 2486 2483 2487 #Call conversion (with zero origin) 2484 ferret2sww('test', verbose= False,2488 ferret2sww('test', verbose=self.verbose, 2485 2489 origin = (56, 0, 0), inverted_bathymetry=False) 2486 2490 … … 2646 2650 2647 2651 #Call conversion (with zero origin) 2648 ferret2sww('test', verbose= False, origin = (56, 0, 0)2652 ferret2sww('test', verbose=self.verbose, origin = (56, 0, 0) 2649 2653 , inverted_bathymetry=False) 2650 2654 … … 2686 2690 2687 2691 #Call conversion (with nonzero origin) 2688 ferret2sww(self.test_MOST_file, verbose= False,2692 ferret2sww(self.test_MOST_file, verbose=self.verbose, 2689 2693 origin = (56, 100000, 200000)) 2690 2694 … … 2726 2730 2727 2731 #Call conversion (with zero origin) 2728 #ferret2sww('small', verbose= False,2732 #ferret2sww('small', verbose=self.verbose, 2729 2733 # origin = (56, 0, 0)) 2730 2734 try: 2731 ferret2sww(self.test_MOST_file, verbose= False,2735 ferret2sww(self.test_MOST_file, verbose=self.verbose, 2732 2736 origin = (56, 0, 0), minlat=-34.5, maxlat=-35) 2733 2737 except AssertionError: … … 2833 2837 2834 2838 filename = domain.datadir + os.sep + domain.get_name() + '.sww' 2835 domain2 = sww2domain(filename,None,fail_if_NaN=False,verbose = False)2839 domain2 = sww2domain(filename,None,fail_if_NaN=False,verbose=self.verbose) 2836 2840 #points, vertices, boundary = rectangular(15,15) 2837 2841 #domain2.boundary = boundary … … 2971 2975 #Fail because NaNs are present 2972 2976 try: 2973 domain2 = sww2domain(filename,boundary,fail_if_NaN=True,verbose= False)2977 domain2 = sww2domain(filename,boundary,fail_if_NaN=True,verbose=self.verbose) 2974 2978 except: 2975 2979 #Now import it, filling NaNs to be 0 2976 2980 filler = 0 2977 domain2 = sww2domain(filename,None,fail_if_NaN=False,NaN_filler = filler,verbose= False)2981 domain2 = sww2domain(filename,None,fail_if_NaN=False,NaN_filler = filler,verbose=self.verbose) 2978 2982 2979 2983 #Clean up … … 3076 3080 3077 3081 filename = domain.datadir + os.sep + domain.get_name() + '.sww' 3078 domain2 = sww2domain(filename,None,fail_if_NaN=False,verbose = False)3082 domain2 = sww2domain(filename,None,fail_if_NaN=False,verbose=self.verbose) 3079 3083 #points, vertices, boundary = rectangular(15,15) 3080 3084 #domain2.boundary = boundary … … 3382 3386 """) 3383 3387 fid.close() 3384 bath_metadata, grid = _read_asc(filename, verbose= False)3388 bath_metadata, grid = _read_asc(filename, verbose=self.verbose) 3385 3389 self.failUnless(bath_metadata['xllcorner'] == 2000.5, 'Failed') 3386 3390 self.failUnless(bath_metadata['yllcorner'] == 3000.5, 'Failed') … … 3495 3499 3496 3500 sww_file = 'a_test.sww' 3497 asc_csiro2sww(bath_dir,elevation_dir, ucur_dir, vcur_dir, sww_file) 3501 asc_csiro2sww(bath_dir,elevation_dir, ucur_dir, vcur_dir, sww_file, 3502 verbose=self.verbose) 3498 3503 3499 3504 # check the sww file … … 3661 3666 try: 3662 3667 asc_csiro2sww(bath_dir,elevation_dir, ucur_dir, 3663 vcur_dir, sww_file) 3668 vcur_dir, sww_file, 3669 verbose=self.verbose) 3664 3670 except: 3665 3671 #tidy up … … 3803 3809 asc_csiro2sww(bath_dir,elevation_dir, ucur_dir, vcur_dir, 3804 3810 sww_file, fail_on_NaN = False, elevation_NaN_filler = 0, 3805 mean_stage = 100) 3811 mean_stage = 100, 3812 verbose=self.verbose) 3806 3813 3807 3814 # check the sww file … … 3994 4001 mean_stage = 100, 3995 4002 minlat = -37.6, maxlat = -37.6, 3996 minlon = 148.3, maxlon = 148.3 4003 minlon = 148.3, maxlon = 148.3, 4004 verbose=self.verbose 3997 4005 #,verbose = True 3998 4006 ) … … 4350 4358 #print "sww_file",sww_file 4351 4359 #print "sww_file",tsh_file 4352 tsh2sww(tsh_file) 4360 tsh2sww(tsh_file, 4361 verbose=self.verbose) 4353 4362 4354 4363 os.remove(tsh_file) … … 4843 4852 tide = 1 4844 4853 try: 4845 urs2sww(base_name, remove_nc_files=True, mean_stage=tide) 4854 urs2sww(base_name, remove_nc_files=True, mean_stage=tide, 4855 verbose=self.verbose) 4846 4856 except ANUGAError: 4847 4857 pass … … 4870 4880 #, origin=(0,0,0) 4871 4881 , mean_stage=tide 4872 , remove_nc_files=True 4882 , remove_nc_files=True, 4883 verbose=self.verbose 4873 4884 ) 4874 4885 sww_file = base_name + '.sww' … … 4965 4976 #, origin=(0,0,0) 4966 4977 , mean_stage=tide 4967 , remove_nc_files=True 4978 , remove_nc_files=True, 4979 verbose=self.verbose 4968 4980 ) 4969 4981 sww_file = base_name + '.sww' … … 5024 5036 , origin=(0,0,0) 5025 5037 , mean_stage=tide 5026 , remove_nc_files=True 5038 , remove_nc_files=True, 5039 verbose=self.verbose 5027 5040 ) 5028 5041 sww_file = base_name + '.sww' … … 5089 5102 maxlon= 151.16667, 5090 5103 mean_stage=tide, 5091 remove_nc_files=True 5104 remove_nc_files=True, 5105 verbose=self.verbose 5092 5106 ) 5093 5107 sww_file = base_name + '.sww' … … 5220 5234 geo=URS_points_needed(boundary_polygon, zone, 5221 5235 ll_lat, ll_long, grid_spacing, 5222 lat_amount, long_amount) 5236 lat_amount, long_amount, 5237 verbose=self.verbose) 5223 5238 # to test this geo, can info from it be transfered onto the boundary 5224 5239 # poly? … … 5271 5286 boundary_polygon = [[250000,7660000],[280000,7660000], 5272 5287 [280000,7630000],[250000,7630000]] 5273 URS_points_needed_to_file('a_test_example',boundary_polygon, ll_lat, ll_long, grid_spacing, \ 5274 lat_amount, long_amount) 5288 URS_points_needed_to_file('a_test_example',boundary_polygon, 5289 ll_lat, ll_long, grid_spacing, 5290 lat_amount, long_amount, 5291 verbose=self.verbose) 5275 5292 5276 5293 def X_test_URS_points_neededII(self): … … 5285 5302 #boundary_polygon = [[7660000,250000],[7660000,280000], 5286 5303 # [7630000,280000],[7630000,250000]] 5287 URS_points_needed(boundary_polygon, ll_lat, ll_long, grid_spacing, \ 5288 lat_amount, long_amount) 5304 URS_points_needed(boundary_polygon, ll_lat, ll_long, grid_spacing, 5305 lat_amount, long_amount, 5306 verbose=self.verbose) 5289 5307 5290 5308 #### END TESTS URS UNGRIDDED 2 SWW ### … … 5333 5351 base_name, files = self.write_mux(lat_long, 5334 5352 time_step_count, time_step) 5335 urs_ungridded2sww(base_name, mean_stage=tide) 5353 urs_ungridded2sww(base_name, mean_stage=tide, 5354 verbose=self.verbose) 5336 5355 5337 5356 # now I want to check the sww file ... … … 5424 5443 base_name, files = self.write_mux(lat_long, 5425 5444 time_step_count, time_step) 5426 urs_ungridded2sww(base_name, mean_stage=tide, origin = geo_reference) 5445 urs_ungridded2sww(base_name, mean_stage=tide, origin = geo_reference, 5446 verbose=self.verbose) 5427 5447 5428 5448 # now I want to check the sww file ... … … 5513 5533 base_name, files = self.write_mux(lat_long, 5514 5534 time_step_count, time_step) 5515 urs_ungridded2sww(base_name, mean_stage=tide, origin =(50,23432,4343)) 5535 urs_ungridded2sww(base_name, mean_stage=tide, origin =(50,23432,4343), 5536 verbose=self.verbose) 5516 5537 5517 5538 # now I want to check the sww file ... … … 5625 5646 5626 5647 urs_ungridded2sww(base_name, mean_stage=-240992.0, 5627 hole_points_UTM=[ 292110.784, 7676551.710 ]) 5648 hole_points_UTM=[ 292110.784, 7676551.710 ], 5649 verbose=self.verbose) 5628 5650 5629 5651 # now I want to check the sww file ... … … 5668 5690 5669 5691 urs_ungridded2sww(base_name, mean_stage=-240992.0, 5670 hole_points_UTM=[ 292110.784, 7676551.710 ]) 5692 hole_points_UTM=[ 292110.784, 7676551.710 ], 5693 verbose=self.verbose) 5671 5694 5672 5695 # now I want to check the sww file ... … … 5706 5729 time_step_count, time_step) 5707 5730 urs_ungridded2sww(base_name, mean_stage=tide, origin =(50,23432,4343), 5708 mint=101, maxt=500) 5731 mint=101, maxt=500, 5732 verbose=self.verbose) 5709 5733 5710 5734 # now I want to check the sww file ... … … 5794 5818 time_step_count, time_step) 5795 5819 urs_ungridded2sww(base_name, mean_stage=tide, origin =(50,23432,4343), 5796 mint=0, maxt=100000) 5820 mint=0, maxt=100000, 5821 verbose=self.verbose) 5797 5822 5798 5823 # now I want to check the sww file ... … … 5839 5864 urs_ungridded2sww(base_name, mean_stage=tide, 5840 5865 origin =(50,23432,4343), 5841 mint=301, maxt=399) 5866 mint=301, maxt=399, 5867 verbose=self.verbose) 5842 5868 except: 5843 5869 pass … … 5864 5890 geo=URS_points_needed(boundary_polygon, zone, 5865 5891 ll_lat, ll_long, grid_spacing, 5866 lat_amount, long_amount) 5892 lat_amount, long_amount, 5893 verbose=self.verbose) 5867 5894 lat_long = geo.get_data_points(as_lat_long=True) 5868 5895 base_name, files = self.write_mux(lat_long, 5869 5896 time_step_count, time_step) 5870 urs_ungridded2sww(base_name, mean_stage=tide) 5897 urs_ungridded2sww(base_name, mean_stage=tide, 5898 verbose=self.verbose) 5871 5899 self.delete_mux(files) 5872 5900 os.remove( base_name + '.sww') -
anuga_core/source/anuga/test_all.py
r4414 r4415 94 94 testCaseClasses = map(load, modules) 95 95 if test_verbose is True: 96 print "moduleNames", moduleNames 97 print "modules", modules 98 print "load", load 99 #print "weak", testCaseClasses.countTestCases() 100 #sys.exit() 101 i=0 102 from anuga.shallow_water.test_data_manager import Test_Data_Manager 103 from anuga.geospatial_data.test_geospatial_data import Test_Geospatial_data 104 #print "test_data_manager.Test_Data_Manager", type(Test_Data_Manager) 96 # Test the code by setting verbose to True. 97 # The test cases have to be set up for this to work. 98 # See test data manager for an example. 105 99 for test_suite in testCaseClasses: 106 i += 1107 print "counting ", i108 #testCaseClass.classVerbose = True109 #testCaseClass.Verbose = True110 #print "testCaseClass",testCaseClass111 #print "testCaseClass",type(tests)112 #print "weak", tests.countTestCases()113 #print "weak", tests.__weakref__114 #print "dic", tests.__dict__115 #print "testCaseClass.tests", testCaseClass._tests[0]._tests[0].yah()116 100 for tests in test_suite._tests: 117 101 #tests is of class TestSuite … … 119 103 if len(tests._tests) >1: 120 104 # these are the test functions 121 print "tests._tests[0]", tests._tests[0]122 print "tests._tests[0]", tests._tests[0].__dict__123 #print "tests._tests[0]", tests._tests[0].__name__124 105 try: 125 106 # Calls set_verbose in the test case classes 126 107 tests._tests[0].set_verbose() 127 108 except: 128 pass # No all classes have 129 tests._tests[0].verbose=True # A call methods 130 if type(tests._tests[0]) == type(Test_Data_Manager): 131 print "testCaseClass is the class Test_Data_Manager" 132 sys.exit() 133 134 if type(tests._tests[0]) == type(Test_Geospatial_data): 135 print "testCaseClass is the class Test_Data_Manager" 136 sys.exit() 137 if isinstance(tests, Test_Data_Manager): 138 print "testCaseClass is an instance of Test_Data_Manager" 139 sys.exit() 140 if type(tests) == type(Test_Data_Manager): 141 print "testCaseClass is the class Test_Data_Manager" 142 sys.exit() 143 144 #sys.exit() 109 pass # No all classes have set_verbose 145 110 return unittest.TestSuite(testCaseClasses) 146 111
Note: See TracChangeset
for help on using the changeset viewer.