Changeset 6314
- Timestamp:
- Feb 12, 2009, 10:11:02 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/util.py
r6277 r6314 1311 1311 thisfile = file_loc[j] + sep + 'gauges_time_series' + '_' \ 1312 1312 + gaugeloc + '.csv' 1313 fid_out = open(thisfile, 'w') 1314 s = 'Time, Stage, Momentum, Speed, Elevation, xmom, ymom, Bearing \n' 1315 fid_out.write(s) 1313 if j == 0: 1314 fid_out = open(thisfile, 'w') 1315 s = 'Time, Stage, Momentum, Speed, Elevation, xmom, ymom, Bearing \n' 1316 fid_out.write(s) 1316 1317 1317 1318 #### generate quantities ####### … … 2373 2374 ## 2374 2375 # @brief ?? 2375 # @param sww_file??2376 # @param ?? 2376 2377 # @param gauge_file ?? 2377 2378 # @param out_name ?? … … 2491 2492 base_name=base, 2492 2493 verbose=verbose) 2494 print 'sww files just after get_all_swwfiles()', sww_files 2495 # fudge to get SWW files in 'correct' order, oldest on the left 2496 sww_files.sort() 2493 2497 2494 2498 if verbose: … … 2507 2511 heading = [quantity for quantity in quantities] 2508 2512 heading.insert(0,'time') 2513 heading.insert(1,'hours') 2509 2514 2510 2515 #create a list of csv writers for all the points and write header 2511 2516 points_writer = [] 2512 for i,point in enumerate(points):2517 for point_i,point in enumerate(points): 2513 2518 points_writer.append(writer(file(dir_name + sep + gauge_file 2514 + point_name[ i] + '.csv', "wb")))2515 points_writer[ i].writerow(heading)2519 + point_name[point_i] + '.csv', "wb"))) 2520 points_writer[point_i].writerow(heading) 2516 2521 2517 2522 if verbose: print 'Writing csv files' 2523 2524 quake_offset_time = None 2518 2525 2519 2526 for sww_file in sww_files: 2520 2527 sww_file = join(dir_name, sww_file+'.sww') 2528 print 'sww file = ',sww_file 2521 2529 callable_sww = file_function(sww_file, 2522 2530 quantities=core_quantities, … … 2524 2532 verbose=verbose, 2525 2533 use_cache=use_cache) 2526 2527 2534 2535 if quake_offset_time is None: 2536 quake_offset_time = callable_sww.starttime 2537 2528 2538 for time in callable_sww.get_time(): 2539 print 'time = ', str(time) 2529 2540 for point_i, point in enumerate(points_array): 2541 print 'gauge_file = ', str(point_name[point_i]) 2542 print 'point_i = ', str(point_i), ' point is = ', str(point) 2530 2543 #add domain starttime to relative time. 2531 points_list = [time + callable_sww.starttime] 2544 quake_time = time + quake_offset_time 2545 points_list = [quake_time, quake_time/3600.]# fudge around SWW time bug 2546 print 'point list = ', str(points_list) 2532 2547 point_quantities = callable_sww(time,point_i) 2548 print 'point quantities = ', str(point_quantities) 2533 2549 2534 2550 for quantity in quantities: … … 2579 2595 point_quantities[3])) 2580 2596 2581 points_writer[point_i].writerow(points_list) 2597 print 'point list before write (writer %s) = %s' % (str(point_name[point_i]), str(points_list)) 2598 points_writer[point_i].writerow(points_list) 2582 2599 2583 2600
Note: See TracChangeset
for help on using the changeset viewer.