Changeset 5734
- Timestamp:
- Sep 5, 2008, 9:54:58 AM (17 years ago)
- Location:
- anuga_core/source/anuga/shallow_water
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/shallow_water/data_manager.py
r5729 r5734 5010 5010 verbose=False, 5011 5011 origin=None, 5012 zone=None, 5012 5013 mean_stage=0.0, 5013 5014 zscale=1.0, … … 5231 5232 5232 5233 for i in range(number_of_points): 5233 zone, easting, northing = redfearn(latitudes[i],longitudes[i] )5234 zone, easting, northing = redfearn(latitudes[i],longitudes[i], zone=zone) 5234 5235 x[i] = easting 5235 5236 y[i] = northing -
anuga_core/source/anuga/shallow_water/test_data_manager.py
r5729 r5734 6360 6360 #Check that first coordinate is correctly represented 6361 6361 #Work out the UTM coordinates for first point 6362 zone, e, n = redfearn(lat_long_points[0][0], lat_long_points[0][1]) 6363 assert allclose([x[0],y[0]], [e,n]) 6362 for i in range(4): 6363 zone, e, n = redfearn(lat_long_points[i][0], lat_long_points[i][1]) 6364 assert allclose([x[i],y[i]], [e,n]) 6364 6365 6365 6366 #Check the time vector … … 6417 6418 self.delete_mux(files) 6418 6419 os.remove(sts_file) 6420 6421 def test_urs2sts_nonstandard_projection(self): 6422 """ 6423 Test single source 6424 """ 6425 tide=0 6426 time_step_count = 3 6427 time_step = 2 6428 lat_long_points =[(-21.,114.5),(-21.,113.5),(-21.,114.), (-21.,115.)] 6429 n=len(lat_long_points) 6430 first_tstep=ones(n,Int) 6431 first_tstep[0]+=1 6432 first_tstep[2]+=1 6433 last_tstep=(time_step_count)*ones(n,Int) 6434 last_tstep[0]-=1 6435 6436 gauge_depth=20*ones(n,Float) 6437 ha=2*ones((n,time_step_count),Float) 6438 ha[0]=arange(0,time_step_count) 6439 ha[1]=arange(time_step_count,2*time_step_count) 6440 ha[2]=arange(2*time_step_count,3*time_step_count) 6441 ha[3]=arange(3*time_step_count,4*time_step_count) 6442 ua=5*ones((n,time_step_count),Float) 6443 va=-10*ones((n,time_step_count),Float) 6444 6445 base_name, files = self.write_mux2(lat_long_points, 6446 time_step_count, time_step, 6447 first_tstep, last_tstep, 6448 depth=gauge_depth, 6449 ha=ha, 6450 ua=ua, 6451 va=va) 6452 6453 urs2sts(base_name, 6454 basename_out=base_name, 6455 zone=50, 6456 mean_stage=tide,verbose=False) 6457 6458 # now I want to check the sts file ... 6459 sts_file = base_name + '.sts' 6460 6461 #Let's interigate the sww file 6462 # Note, the sww info is not gridded. It is point data. 6463 fid = NetCDFFile(sts_file) 6464 6465 # Make x and y absolute 6466 x = fid.variables['x'][:] 6467 y = fid.variables['y'][:] 6468 6469 geo_reference = Geo_reference(NetCDFObject=fid) 6470 points = geo_reference.get_absolute(map(None, x, y)) 6471 points = ensure_numeric(points) 6472 6473 x = points[:,0] 6474 y = points[:,1] 6475 6476 #Check that all coordinate are correctly represented 6477 #Using the non standard projection (50) 6478 for i in range(4): 6479 zone, e, n = redfearn(lat_long_points[i][0], lat_long_points[i][1], zone=50) 6480 assert allclose([x[i],y[i]], [e,n]) 6481 assert zone==geo_reference.zone 6419 6482 6420 6483 def test_urs2stsII(self):
Note: See TracChangeset
for help on using the changeset viewer.