Changeset 4918
- Timestamp:
- Jan 9, 2008, 2:24:52 PM (17 years ago)
- Location:
- anuga_core/source/anuga/abstract_2d_finite_volumes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/test_util.py
r4910 r4918 1580 1580 # points_file = 'test_point.csv' 1581 1581 file_id = open(points_file,"w") 1582 file_id.write("name, easting,northing \n\1582 file_id.write("name,easting,northing \n\ 1583 1583 point1, 5.0, 1.0\n\ 1584 1584 point2, 0.5, 2.0\n") … … 1641 1641 if __name__ == "__main__": 1642 1642 suite = unittest.makeSuite(Test_Util,'test') 1643 # suite = unittest.makeSuite(Test_Util,'test_ gauges_sww')1643 # suite = unittest.makeSuite(Test_Util,'test_sww2') 1644 1644 # runner = unittest.TextTestRunner(verbosity=2) 1645 1645 runner = unittest.TextTestRunner(verbosity=1) -
anuga_core/source/anuga/abstract_2d_finite_volumes/util.py
r4912 r4918 18 18 19 19 from anuga.geospatial_data.geospatial_data import ensure_absolute 20 from math import sqrt, atan, degrees 20 21 21 22 … … 947 948 """ Calculate velocity bearing from North 948 949 """ 949 from math import atan, degrees950 # from math import atan, degrees 950 951 951 952 angle = degrees(atan(vh/(uh+1.e-15))) … … 971 972 each sww file 972 973 """ 973 from math import sqrt, atan, degrees974 # from math import sqrt, atan, degrees 974 975 from Numeric import ones, allclose, zeros, Float, ravel 975 976 from os import sep, altsep, getcwd, mkdir, access, F_OK, environ … … 2328 2329 point2, 10.3, 70.3, 78.0 2329 2330 2331 NOTE: order of column can change but names eg 'easting', elevation' 2332 must be the same! 2333 2330 2334 Outputs: 2331 2335 one file for each gauge/point location in the points file. They … … 2372 2376 %(gauge_file, e) 2373 2377 raise msg 2374 if verbose: print '\n Gauges obtained from: %s \n' %gauge_file name2378 if verbose: print '\n Gauges obtained from: %s \n' %gauge_file 2375 2379 2376 2380 … … 2379 2383 point_name = [] 2380 2384 2381 #skip header2382 point_reader.next()2383 2385 #read point info from file 2384 2386 for i,row in enumerate(point_reader): 2385 2387 # print 'i',i,'row',row 2386 points.append([float(row[1]),float(row[2])]) 2387 point_name.append(row[0]) 2388 #read header and determine the column numbers to read correcty. 2389 if i==0: 2390 for j,value in enumerate(row): 2391 # print 'j',j,value, row 2392 if value.strip()=='easting':easting=j 2393 if value.strip()=='northing':northing=j 2394 if value.strip()=='name':name=j 2395 if value.strip()=='elevation':elevation=j 2396 else: 2397 # print i,'easting',easting,'northing',northing, row[easting] 2398 points.append([float(row[easting]),float(row[northing])]) 2399 point_name.append(row[name]) 2388 2400 2389 2401 #convert to array for file_function … … 2480 2492 momentum = sqrt(point_quantities[2]**2 +\ 2481 2493 point_quantities[3]**2) 2482 vel = momentum/depth 2494 # vel = momentum/depth 2495 vel = momentum/(point_quantities[0] - point_quantities[1]) 2483 2496 # vel = momentum/(depth + 1.e-6/depth) 2484 2497
Note: See TracChangeset
for help on using the changeset viewer.