Changeset 2305
- Timestamp:
- Jan 31, 2006, 12:33:19 PM (19 years ago)
- Location:
- inundation
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/README.txt
r2179 r2305 8 8 9 9 10 This is the top directory for the inundation project developed at the 11 Risk Assessment Methods Project at Geoscience Australia and 12 Mathematical Sciences Institute at the Australian National University. 10 This is the top directory for the inundation project source code 11 developed at the Risk Assessment Methods Project at Geoscience 12 Australia and Mathematical Sciences Institute at the Australian 13 National University. 13 14 14 15 15 Copyright 2004 16 Ole Nielsen, Stephen Roberts, Duncan Gray, Christopher Zoppou16 Copyright 2004, 2005, 2006 17 Ole Nielsen, Stephen Roberts, Duncan Gray, Jane Sexton, Christopher Zoppou 17 18 18 19 -
inundation/pyvolution/data_manager.py
r2262 r2305 2669 2669 2670 2670 2671 domain = Domain(coordinates, volumes, boundary) 2671 try: 2672 domain = Domain(coordinates, volumes, boundary) 2673 except AssertionError, e: 2674 fid.close() 2675 msg = 'Domain could not be created: %s. Perhaps use "fail_if_NaN=False and NaN_filler = ..."' %e 2676 raise msg 2672 2677 2673 2678 if not boundary is None: … … 2728 2733 X = resize(X,(X.shape[0]/3,3)) 2729 2734 domain.set_quantity(quantity,X) 2735 2730 2736 fid.close() 2731 2737 return domain … … 3000 3006 volumes = fid.variables['volumes'] #Connectivity 3001 3007 3008 #FIXME (Ole): What is this? 3009 # Why isn't anything returned? 3010 # Where's the unit test? 3002 3011 3003 3012 def decimate_dem(basename_in, stencil, cellsize_new, basename_out=None, -
inundation/pyvolution/test_data_manager.py
r2304 r2305 141 141 142 142 143 fid.close() 143 fid.close() 144 144 145 145 146 … … 147 148 def tearDown(self): 148 149 import os 149 #os.remove(self.test_MOST_file) 150 150 for ext in ['_ha.nc', '_ua.nc', '_va.nc', '_e.nc']: 151 #print 'Trying to remove', self.test_MOST_file + ext 152 os.remove(self.test_MOST_file + ext) 151 153 152 154 def test_sww_constant(self): … … 1865 1867 #Done (Ole) - it was because sww2ers didn't close it's sww file 1866 1868 os.remove(sww.filename) 1869 os.remove(self.domain.filename + '_elevation') 1870 os.remove(self.domain.filename + '_elevation.ers') 1867 1871 1868 1872 … … 1891 1895 first_value = fid.variables['HA'][:][0,0,0] 1892 1896 fourth_value = fid.variables['HA'][:][0,0,3] 1897 fid.close() 1893 1898 1894 1899 … … 1930 1935 #Cleanup 1931 1936 import os 1932 #os.remove('small.sww')1933 1937 os.remove(self.test_MOST_file + '.sww') 1934 1938 … … 2232 2236 2233 2237 2234 def test_sww2domain (self):2238 def test_sww2domain1(self): 2235 2239 ################################################ 2236 2240 #Create a test domain, and evolve and save it. … … 2298 2302 ################### 2299 2303 2300 os.remove(domain.filename + '.sww') 2304 #os.remove(domain.filename + '.sww') 2305 os.remove(filename) 2301 2306 2302 2307 bits = ['vertex_coordinates'] … … 2390 2395 domain.visualise = False 2391 2396 domain.store = True 2392 domain.filename = 'bedslope' 2397 domain.set_name('test_file') 2398 domain.set_datadir('.') 2393 2399 domain.default_order=2 2394 2400 domain.quantities_to_be_stored=['stage'] … … 2430 2436 try: 2431 2437 domain2 = sww2domain(filename,boundary,fail_if_NaN=True,verbose=False) 2432 assert True == False2433 2438 except: 2434 2439 #Now import it, filling NaNs to be 0 … … 2436 2441 domain2 = sww2domain(filename,None,fail_if_NaN=False,NaN_filler = filler,verbose=False) 2437 2442 2443 #Clean up 2444 os.remove(filename) 2438 2445 2439 2446 … … 2455 2462 assert min(min(domain2.get_quantity('ymomentum')))==filler 2456 2463 2457 #print 'passed'2458 2459 #FIXME (DSG-all) this doesn't work (in windows), due to permitions2460 #it the file is created in the temp area this problem2461 # might be avoided2462 2463 #cleanup2464 #import os2465 #os.remove(domain.datadir+'/'+domain.filename+'.sww')2466 for filename in os.listdir('.'):2467 if filename.endswith('sww'):2468 print filename2469 os.remove(domain.filename + '.sww')2470 2464 2471 2465 -
inundation/pyvolution/test_shallow_water.py
r1835 r2305 726 726 assert not allclose(stage, initial_stage) 727 727 728 os.remove(domain.filename + '.sww') 728 729 729 730 … … 1013 1014 from data_manager import timefile2netcdf 1014 1015 timefile2netcdf(filename) 1015 1016 os.remove(filename + '.txt') 1016 1017 1017 1018 … … 1019 1020 F = file_function(filename + '.tms', quantities = ['Attribute0', 1020 1021 'Attribute1']) 1022 os.remove(filename + '.tms') 1023 1021 1024 1022 1025 #print 'F(5)', F(5) … … 1067 1070 assert allclose(domain.quantities['ymomentum'].explicit_update[k], S*v) 1068 1071 1069 #os.remove(filename + '.txt') 1072 1073 1070 1074 1071 1075 def test_wind_stress_error_condition(self): … … 1607 1611 #assert allclose (xmom, initial_xmom) 1608 1612 1613 os.remove(domain.filename + '.sww') 1609 1614 1610 1615 … … 1659 1664 #assert allclose (xmom, initial_xmom) 1660 1665 1666 os.remove(domain.filename + '.sww') 1661 1667 1662 1668 def test_conservation_3(self): … … 1734 1740 assert allclose (volume, initial_volume) 1735 1741 1742 os.remove(domain.filename + '.sww') 1736 1743 1737 1744 def test_conservation_4(self): … … 1820 1827 1821 1828 1822 1829 os.remove(domain.filename + '.sww') 1823 1830 1824 1831 … … 1883 1890 1884 1891 1885 1892 os.remove(domain.filename + '.sww') 1886 1893 1887 1894 … … 1951 1958 assert allclose(ref, now), msg 1952 1959 1953 1960 os.remove(domain.filename + '.sww') 1954 1961 1955 1962 def test_second_order_flat_bed_onestep(self): … … 2020 2027 -1.22721531e-004, -4.57969873e-005]) 2021 2028 2029 os.remove(domain.filename + '.sww') 2022 2030 2023 2031 … … 2052 2060 #assert allclose(domain.max_timestep, 0.0396825396825) 2053 2061 #print domain.quantities['stage'].centroid_values 2062 2063 os.remove(domain.filename + '.sww') 2054 2064 2055 2065 … … 2097 2107 #assert allclose(domain.quantities['ymomentum'].edge_values[:4,i], 2098 2108 # [-0.0060238, -0.00157404, -0.00309633, -0.0001637]) 2109 2110 2111 os.remove(domain.filename + '.sww') 2099 2112 2100 2113 def test_flatbed_second_order(self): … … 2148 2161 [-0.00139463,0.0006156,-0.00060364,0.00061827]) 2149 2162 2163 2164 os.remove(domain.filename + '.sww') 2150 2165 2151 2166 … … 2291 2306 # [0.00090581,0.03685719,0.00088303,0.03687313]) 2292 2307 2293 2308 os.remove(domain.filename + '.sww') 2294 2309 2295 2310 … … 2331 2346 2332 2347 2348 os.remove(domain.filename + '.sww') 2349 2333 2350 def test_bedslope_problem_first_order_moresteps(self): 2334 2351 … … 2393 2410 -0.14439383, -0.13924047, -0.14829043]) 2394 2411 2395 2412 os.remove(domain.filename + '.sww') 2413 2396 2414 def test_bedslope_problem_second_order_one_step(self): 2397 2415 … … 2479 2497 -0.25865535, -0.24776246, -0.25865535, -0.24521113]) 2480 2498 2481 2499 os.remove(domain.filename + '.sww') 2482 2500 2483 2501 def test_bedslope_problem_second_order_two_steps(self): … … 2572 2590 2573 2591 2574 2592 os.remove(domain.filename + '.sww') 2575 2593 2576 2594 def test_bedslope_problem_second_order_two_yieldsteps(self): … … 2661 2679 -0.24286438]) 2662 2680 2663 2681 os.remove(domain.filename + '.sww') 2664 2682 2665 2683 def test_bedslope_problem_second_order_more_steps(self): … … 2777 2795 -4.50964850e-003, -3.06319963e-003, 6.08950810e-004, -4.79537921e-004]) 2778 2796 2779 2797 os.remove(domain.filename + '.sww') 2780 2798 2781 2799 … … 2821 2839 -6.39083123e-005, 6.29815168e-005]) 2822 2840 2841 os.remove(domain.filename + '.sww') 2823 2842 2824 2843 def test_complex_bed(self): … … 2898 2917 # -5.48333333e-001, -5.31666667e-001, -5.48333333e-001, -5.31666667e-001]) 2899 2918 2900 2901 2902 def test_spatio_temporal_boundary (self):2919 os.remove(domain.filename + '.sww') 2920 2921 def test_spatio_temporal_boundary_1(self): 2903 2922 """Test that boundary values can be read from file and interpolated 2904 2923 in both time and space. … … 3018 3037 #Cleanup 3019 3038 os.remove(domain1.filename + '.' + domain1.format) 3039 os.remove(domain2.filename + '.' + domain2.format) 3020 3040 3021 3041
Note: See TracChangeset
for help on using the changeset viewer.