Changeset 4338
- Timestamp:
- Mar 29, 2007, 4:36:47 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/util.py
r4320 r4338 70 70 'interpolation_points': interpolation_points, 71 71 'time_thinning': time_thinning, 72 'verbose': verbose, 73 'use_cache': use_cache 74 } 75 76 #caching moved to deeper within the function to avoid caching an 77 #instance of an object, which isn't generally good. 78 f = apply(_file_function, 72 'verbose': verbose} 73 74 75 # Call underlying engine with or without caching 76 if use_cache is True: 77 try: 78 from caching import cache 79 except: 80 msg = 'Caching was requested, but caching module'+\ 81 'could not be imported' 82 raise msg 83 84 f = cache(_file_function, 85 args, kwargs, 86 dependencies=[filename], 87 compression=False, 88 verbose=verbose) 89 90 else: 91 f = apply(_file_function, 79 92 args, kwargs) 80 93 … … 92 105 quantities=None, 93 106 interpolation_points=None, 94 time_thinning=1, 95 verbose=False, 96 use_cache=False): 107 time_thinning=1, 108 verbose=False): 97 109 """Internal function 98 110 … … 134 146 interpolation_points, 135 147 time_thinning=time_thinning, 136 verbose=verbose, 137 use_cache=use_cache) 148 verbose=verbose) 138 149 else: 139 150 raise 'Must be a NetCDF File' … … 146 157 interpolation_points=None, 147 158 time_thinning=1, 148 verbose=False, 149 use_cache=False): 159 verbose=False): 150 160 """Read time history of spatial data from NetCDF sww file and 151 161 return a callable object f(t,x,y) … … 315 325 vertex_coordinates = triangles = interpolation_points = None 316 326 317 318 319 args = (time, quantities, quantity_names, vertex_coordinates, 320 triangles, interpolation_points, ) 321 322 kwargs = {'time_thinning': time_thinning, 323 'verbose': verbose 324 } 325 326 # print'CACHING FROM UTIL.py for interpolation_function', use_cache 327 # from anuga.caching import myhash 328 if use_cache is True: 329 from caching import cache 330 331 interpolation_function = cache(Interpolation_function, 332 args, kwargs, 333 verbose=verbose, 334 compression=False) 335 else: 336 interpolation_function = apply(Interpolation_function, 337 args, kwargs) 338 # print 'myhash', myhash(interpolation_function) 339 return interpolation_function 340 327 return Interpolation_function(time, 328 quantities, 329 quantity_names, 330 vertex_coordinates, 331 triangles, 332 interpolation_points, 333 time_thinning=time_thinning, 334 verbose=verbose) 341 335 342 336
Note: See TracChangeset
for help on using the changeset viewer.