Changeset 7673 for anuga_core/source/anuga/abstract_2d_finite_volumes
- Timestamp:
- Mar 31, 2010, 10:57:09 PM (14 years ago)
- Location:
- anuga_core/source/anuga/abstract_2d_finite_volumes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/gauge.py
r7672 r7673 180 180 verbose=verbose, 181 181 use_cache=use_cache, 182 182 output_centroids = output_centroids) 183 183 184 184 if quake_offset_time is None: … … 190 190 quake_time = time + quake_offset_time 191 191 points_list = [quake_time, quake_time/3600.]# fudge around SWW time bug 192 point_quantities = callable_sww(time,point_i) 193 192 point_quantities = callable_sww(time,point_i) # __call__ is overridden 193 194 194 for quantity in quantities: 195 195 if quantity == NAN: … … 271 271 title_on=None, 272 272 use_cache=False, 273 verbose=False): 273 verbose=False, 274 output_centroids=False): 274 275 """ Read sww file and plot the time series for the 275 276 prescribed quantities at defined gauge locations and … … 388 389 title_on, 389 390 use_cache, 390 verbose) 391 verbose, 392 output_centroids = output_centroids) 391 393 return k 392 394 … … 423 425 title_on = None, 424 426 use_cache = False, 425 verbose = False): 427 verbose = False, 428 output_centroids = False): 426 429 427 430 # FIXME(Ole): Shouldn't print statements here be governed by verbose? … … 486 489 time_thinning = time_thinning, 487 490 verbose = verbose, 488 use_cache = use_cache) 491 use_cache = use_cache, 492 output_centroids = output_centroids) 489 493 490 494 # determine which gauges are contained in sww file -
anuga_core/source/anuga/abstract_2d_finite_volumes/test_gauge.py
r7672 r7673 451 451 452 452 # create a csv file containing our gauge points 453 points = [[2.0,1.0],[ 5.0,5.0]]453 points = [[2.0,1.0],[4.5,4.0]] 454 454 455 455 points_file = tempfile.mktemp(".csv") 456 456 file_id = open(points_file,"w") 457 # These values are where the centroids should be 457 # These values are where the centroids should be 458 458 # file_id.write("name, easting, northing, elevation \n\ 459 #point1, 1.5, 1.5, 3.0\n\460 #point2, 4. 5, 4.5, 9.0\n")459 #point1, 2.0, 2.0, 3.0\n\ 460 #point2, 4.0, 4.0, 9.0\n") 461 461 462 # These values are slightly off the centroids - will it find them?462 # These values are slightly off the centroids - will it find the centroids? 463 463 file_id.write("name, easting, northing, elevation \n\ 464 464 point1, 2.0, 1.0, 3.0\n\ 465 point2, 5.5, 4.0, 9.0\n")465 point2, 4.5, 4.0, 9.0\n") 466 466 467 467 … … 474 474 output_centroids=True) 475 475 476 point1_answers_array = [[0.0,0.0,1.0, 2.5,-1.5,3.0,4.0], [2.0,2.0/3600.,10.0,11.5,-1.5,3.0,4.0]]476 point1_answers_array = [[0.0,0.0,1.0,3.0,-2.0,3.0,4.0], [2.0,2.0/3600.,10.0,12.0,-2.0,3.0,4.0]] 477 477 point1_filename = 'gauge_point1.csv' 478 478 point1_handle = file(point1_filename) … … 482 482 line=[] 483 483 for i,row in enumerate(point1_reader): 484 # print 'i',i,'row',row485 484 line.append([float(row[0]),float(row[1]),float(row[2]),float(row[3]), 486 485 float(row[4]),float(row[5]),float(row[6])]) … … 488 487 assert num.allclose(line[i], point1_answers_array[i]) 489 488 490 point2_answers_array = [[0.0,0.0,1.0,5. 5,-4.5,3.0,4.0], [2.0,2.0/3600.,10.0,14.5,-4.5,3.0,4.0]]489 point2_answers_array = [[0.0,0.0,1.0,5.0,-4.0,3.0,4.0], [2.0,2.0/3600.,10.0,14.0,-4.0,3.0,4.0]] 491 490 point2_filename = 'gauge_point2.csv' 492 491 point2_handle = file(point2_filename) … … 496 495 line=[] 497 496 for i,row in enumerate(point2_reader): 498 # print 'i',i,'row',row499 497 line.append([float(row[0]),float(row[1]),float(row[2]),float(row[3]), 500 498 float(row[4]),float(row[5]),float(row[6])]) 501 # print 'assert line',line[i],'point1',point1_answers_array[i]499 # print i, 'assert line',line[i],'point2',point2_answers_array[i] 502 500 assert num.allclose(line[i], point2_answers_array[i]) 503 501 -
anuga_core/source/anuga/abstract_2d_finite_volumes/util.py
r7672 r7673 54 54 use_cache=False, 55 55 boundary_polygon=None, 56 56 output_centroids=False): 57 57 """Read time history of spatial data from NetCDF file and return 58 58 a callable object. … … 140 140 'verbose': verbose, 141 141 'boundary_polygon': boundary_polygon, 142 142 'output_centroids': output_centroids} 143 143 144 144 # Call underlying engine with or without caching … … 232 232 verbose=verbose, 233 233 boundary_polygon=boundary_polygon, 234 234 output_centroids=output_centroids) 235 235 else: 236 236 # FIXME (Ole): Could add csv file here to address Ted Rigby's … … 260 260 verbose=False, 261 261 boundary_polygon=None, 262 262 output_centroids=False): 263 263 """Read time history of spatial data from NetCDF sww file and 264 264 return a callable object f(t,x,y) … … 501 501 time_thinning=time_thinning, 502 502 verbose=verbose, 503 gauge_neighbour_id=gauge_neighbour_id), 503 gauge_neighbour_id=gauge_neighbour_id, 504 output_centroids=output_centroids), 504 505 starttime) 505 506
Note: See TracChangeset
for help on using the changeset viewer.