- Timestamp:
- Jun 30, 2009, 2:07:41 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/util.py
r7012 r7276 27 27 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a 28 28 29 import Numericas num29 import numpy as num 30 30 31 31 … … 476 476 if boundary_polygon is not None: 477 477 #removes sts points that do not lie on boundary 478 quantities[name] = num.take(quantities[name], gauge_id, 1)478 quantities[name] = num.take(quantities[name], gauge_id, axis=1) 479 479 480 480 # Close sww, tms or sts netcdf file … … 554 554 expression e.g. by overloading 555 555 556 Due to a limitation with Numeric, this can not evaluate 0/0556 Due to a limitation with numeric, this can not evaluate 0/0 557 557 In general, the user can fix by adding 1e-30 to the numerator. 558 558 SciPy core can handle this situation. … … 789 789 - easting, northing, name , elevation? 790 790 - OR (this is not yet done) 791 - structure which can be converted to a Numeric array,791 - structure which can be converted to a numeric array, 792 792 such as a geospatial data object 793 793 … … 1256 1256 n0 = int(n0) 1257 1257 m = len(locations) 1258 model_time = num.zeros((n0, m, p), num. Float)1259 stages = num.zeros((n0, m, p), num. Float)1260 elevations = num.zeros((n0, m, p), num. Float)1261 momenta = num.zeros((n0, m, p), num. Float)1262 xmom = num.zeros((n0, m, p), num. Float)1263 ymom = num.zeros((n0, m, p), num. Float)1264 speed = num.zeros((n0, m, p), num. Float)1265 bearings = num.zeros((n0, m, p), num. Float)1266 due_east = 90.0*num.ones((n0, 1), num. Float)1267 due_west = 270.0*num.ones((n0, 1), num. Float)1268 depths = num.zeros((n0, m, p), num. Float)1269 eastings = num.zeros((n0, m, p), num. Float)1258 model_time = num.zeros((n0, m, p), num.float) 1259 stages = num.zeros((n0, m, p), num.float) 1260 elevations = num.zeros((n0, m, p), num.float) 1261 momenta = num.zeros((n0, m, p), num.float) 1262 xmom = num.zeros((n0, m, p), num.float) 1263 ymom = num.zeros((n0, m, p), num.float) 1264 speed = num.zeros((n0, m, p), num.float) 1265 bearings = num.zeros((n0, m, p), num.float) 1266 due_east = 90.0*num.ones((n0, 1), num.float) 1267 due_west = 270.0*num.ones((n0, 1), num.float) 1268 depths = num.zeros((n0, m, p), num.float) 1269 eastings = num.zeros((n0, m, p), num.float) 1270 1270 min_stages = [] 1271 1271 max_stages = [] … … 1279 1279 min_speeds = [] 1280 1280 max_depths = [] 1281 model_time_plot3d = num.zeros((n0, m), num. Float)1282 stages_plot3d = num.zeros((n0, m), num. Float)1283 eastings_plot3d = num.zeros((n0, m),num. Float)1281 model_time_plot3d = num.zeros((n0, m), num.float) 1282 stages_plot3d = num.zeros((n0, m), num.float) 1283 eastings_plot3d = num.zeros((n0, m),num.float) 1284 1284 if time_unit is 'mins': scale = 60.0 1285 1285 if time_unit is 'hours': scale = 3600.0 … … 1800 1800 # Remove the loners from verts 1801 1801 # Could've used X=compress(less(loners,N),loners) 1802 # verts=num.take(verts,X ) to Remove the loners from verts1802 # verts=num.take(verts,X,axis=0) to Remove the loners from verts 1803 1803 # but I think it would use more memory 1804 1804 new_i = lone_start # point at first loner - 'shuffle down' target … … 1834 1834 """ 1835 1835 1836 xc = num.zeros(triangles.shape[0], num. Float) # Space for centroid info1836 xc = num.zeros(triangles.shape[0], num.float) # Space for centroid info 1837 1837 1838 1838 for k in range(triangles.shape[0]): … … 2121 2121 #add tide to stage if provided 2122 2122 if quantity == 'stage': 2123 quantity_value[quantity] = num.array(quantity_value[quantity], num.Float) \2124 + directory_add_tide2123 quantity_value[quantity] = num.array(quantity_value[quantity], 2124 num.float) + directory_add_tide 2125 2125 2126 2126 #condition to find max and mins for all the plots … … 2370 2370 file.close() 2371 2371 2372 2373 2372 ## 2374 2373 # @brief ?? … … 2389 2388 2390 2389 Inputs: 2391 2392 2390 NOTE: if using csv2timeseries_graphs after creating csv file, 2393 2391 it is essential to export quantities 'depth' and 'elevation'. … … 2414 2412 myfile_2_point1.csv if <out_name> ='myfile_2_' 2415 2413 2416 2417 2414 They will all have a header 2418 2415 … … 2438 2435 import string 2439 2436 from anuga.shallow_water.data_manager import get_all_swwfiles 2440 2441 # quantities = ['stage', 'elevation', 'xmomentum', 'ymomentum']2442 #print "points",points2443 2437 2444 2438 assert type(gauge_file) == type(''), 'Gauge filename must be a string' … … 2457 2451 point_name = [] 2458 2452 2459 # read point info from file2453 # read point info from file 2460 2454 for i,row in enumerate(point_reader): 2461 # read header and determine the column numbers to read correcty.2455 # read header and determine the column numbers to read correctly. 2462 2456 if i==0: 2463 2457 for j,value in enumerate(row): … … 2471 2465 2472 2466 #convert to array for file_function 2473 points_array = num.array(points,num. Float)2467 points_array = num.array(points,num.float) 2474 2468 2475 2469 points_array = ensure_absolute(points_array) … … 2525 2519 for sww_file in sww_files: 2526 2520 sww_file = join(dir_name, sww_file+'.sww') 2527 #print 'sww file = ',sww_file2528 2521 callable_sww = file_function(sww_file, 2529 2522 quantities=core_quantities, … … 2579 2572 momentum = sqrt(point_quantities[2]**2 2580 2573 + point_quantities[3]**2) 2581 # vel = momentum/depth2582 2574 vel = momentum / (point_quantities[0] 2583 2575 - point_quantities[1]) 2584 # vel = momentum/(depth + 1.e-6/depth)2585 2576 else: 2586 2577 momentum = 0 … … 2593 2584 point_quantities[3])) 2594 2585 2595 #print 'point list before write (writer %s) = %s' % (str(point_name[point_i]), str(points_list))2596 2586 points_writer[point_i].writerow(points_list) 2597 2598 2587 2599 2588 ##
Note: See TracChangeset
for help on using the changeset viewer.