Changeset 6689 for branches/numpy/anuga/shallow_water/test_data_manager.py
- Timestamp:
- Apr 1, 2009, 3:19:07 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/numpy/anuga/shallow_water/test_data_manager.py
r6553 r6689 1221 1221 1222 1222 def test_sww2dem_asc_elevation_depth(self): 1223 """ 1224 test_sww2dem_asc_elevation_depth(self):1223 """test_sww2dem_asc_elevation_depth 1224 1225 1225 Test that sww information can be converted correctly to asc/prj 1226 1226 format readable by e.g. ArcView 1227 1228 Also check geo_reference is correct 1227 1229 """ 1228 1230 … … 1249 1251 sww.store_timestep() 1250 1252 1251 #self.domain.tight_slope_limiters = 11252 1253 1253 1254 self.domain.evolve_to_end(finaltime = 0.01) … … 2000 2001 number_of_decimal_places = 9, 2001 2002 verbose = self.verbose, 2002 format = 'asc') 2003 format = 'asc', 2004 block_size=2) 2003 2005 2004 2006 … … 5064 5066 #print "longitudes_news",longitudes_news 5065 5067 5066 self.failUnless(latitudes_new == [-35, -40, -45] and \5068 self.failUnless(latitudes_new == [-35, -40, -45] and 5067 5069 longitudes_news == [148, 149,150], 5068 5070 'failed') … … 5519 5521 na and va quantities will be the Easting values. 5520 5522 Depth and ua will be the Northing value. 5523 5524 The mux file format has south as positive so 5525 this function will swap the sign for va. 5521 5526 """ 5522 5527 … … 6036 6041 quantities_init[2].append(num.ones(time_step_count,num.float)*this_va) # 6037 6042 else: 6038 quantities_init[2].append( va[i])6043 quantities_init[2].append(-va[i]) # South is negative in MUX 6039 6044 6040 6045 file_handle, base_name = tempfile.mkstemp("") … … 6158 6163 assert num.allclose(xvelocity,ua) 6159 6164 msg='incorrect gauge va time series returned' 6160 assert num.allclose(yvelocity, va)6165 assert num.allclose(yvelocity, -va) 6161 6166 6162 6167 def test_urs2sts_read_mux2_pyII(self): … … 6216 6221 assert num.allclose(xvelocity,ua) 6217 6222 msg='incorrect gauge va time series returned' 6218 assert num.allclose(yvelocity, va)6223 assert num.allclose(yvelocity, -va) # South is positive in MUX 6219 6224 6220 6225 def test_urs2sts_read_mux2_pyIII(self): … … 6288 6293 assert num.allclose(xvelocity,ua) 6289 6294 msg='incorrect gauge va time series returned' 6290 assert num.allclose(yvelocity, va)6295 assert num.allclose(yvelocity, -va) # South is positive in mux 6291 6296 6292 6297 … … 6390 6395 if j == 0: assert num.allclose(data[i][:parameters_index], ha0[permutation[i], :]) 6391 6396 if j == 1: assert num.allclose(data[i][:parameters_index], ua0[permutation[i], :]) 6392 if j == 2: assert num.allclose(data[i][:parameters_index], va0[permutation[i], :])6397 if j == 2: assert num.allclose(data[i][:parameters_index], -va0[permutation[i], :]) 6393 6398 6394 6399 … … 6596 6601 x = unpack('f',f.read(4))[0] 6597 6602 #print time, x, q_time[time, point_i] 6603 if q == 'VA': x = -x # South is positive in MUX 6598 6604 assert abs(q_time[time, point_i]-x)<epsilon 6599 6605 … … 6669 6675 #print 'v ', data[i][:parameters_index][8] 6670 6676 6671 assert num.allclose(data[i][:parameters_index], va1[permutation[i], :]) 6677 # South is positive in MUX 6678 assert num.allclose(data[i][:parameters_index], -va1[permutation[i], :]) 6672 6679 6673 6680 … … 6787 6794 os.remove(sts_file) 6788 6795 6789 def test_urs2sts_nonstandard_ projection(self):6796 def test_urs2sts_nonstandard_meridian(self): 6790 6797 """ 6791 Test single source 6798 Test single source using the meridian from zone 50 as a nonstandard meridian 6792 6799 """ 6793 6800 tide=0 … … 6821 6828 urs2sts(base_name, 6822 6829 basename_out=base_name, 6823 zone=50, 6824 mean_stage=tide,verbose=False) 6830 central_meridian=123, 6831 mean_stage=tide, 6832 verbose=False) 6825 6833 6826 6834 # now I want to check the sts file ... … … 6845 6853 #Using the non standard projection (50) 6846 6854 for i in range(4): 6847 zone, e, n = redfearn(lat_long_points[i][0], lat_long_points[i][1], zone=50) 6855 zone, e, n = redfearn(lat_long_points[i][0], 6856 lat_long_points[i][1], 6857 central_meridian=123) 6848 6858 assert num.allclose([x[i],y[i]], [e,n]) 6849 assert zone==geo_reference.zone 6850 6859 assert zone==-1 6860 6861 6851 6862 def test_urs2sts_nonstandard_projection_reverse(self): 6852 6863 """ … … 6907 6918 #Using the non standard projection (50) 6908 6919 for i in range(4): 6909 zone, e, n = redfearn(lat_long_points[i][0], lat_long_points[i][1], zone=50) 6920 zone, e, n = redfearn(lat_long_points[i][0], lat_long_points[i][1], 6921 zone=50) 6910 6922 assert num.allclose([x[i],y[i]], [e,n]) 6911 6923 assert zone==geo_reference.zone … … 7191 7203 msg = 'urs stage is not equal to sts stage for for source %i and station %i' %(source_number,j) 7192 7204 assert num.allclose(urs_stage[index_start_urs_z:index_end_urs_z], 7193 sts_stage[index_start_stage:index_end_stage],7194 rtol=1.0e-6, atol=1.0e-5 ), msg7205 sts_stage[index_start_stage:index_end_stage], 7206 rtol=1.0e-6, atol=1.0e-5 ), msg 7195 7207 7196 7208 # check that urs e velocity and sts xmomentum are the same … … 7205 7217 msg = 'urs n velocity is not equivalent to sts y momentum for source %i and station %i' %(source_number,j) 7206 7218 assert num.allclose(urs_n[index_start_urs_n:index_end_urs_n]*(urs_stage[index_start_urs_n:index_end_urs_n]-elevation[j]), 7207 sts_ymom[index_start_y:index_end_y],7219 -sts_ymom[index_start_y:index_end_y], 7208 7220 rtol=1.0e-5, atol=1.0e-4 ), msg 7209 7221 … … 10596 10608 ymomentum = fid.variables['ymomentum'][:] 10597 10609 10610 10611 10598 10612 for i in range(stage.shape[0]): 10599 10613 h = stage[i]-z # depth vector at time step i … … 10646 10660 10647 10661 # Check runup restricted to a polygon 10648 p = num.array([[50,1], [99,1], [99,49], [50,49]], num.int) + \ 10649 num.array([E, N], num.int) #array default# 10662 p = num.array([[50,1], [99,1], [99,49], [50,49]], num.int) + num.array([E, N], num.int) #array default# 10650 10663 10651 10664 runup = get_maximum_inundation_elevation(swwfile, polygon=p)
Note: See TracChangeset
for help on using the changeset viewer.