- Timestamp:
- Nov 1, 2006, 10:58:50 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/util.py
r3850 r3900 13 13 14 14 def file_function(filename, 15 domain = None, 16 quantities = None, 17 interpolation_points = None, 18 verbose = False, 19 use_cache = False): 15 domain=None, 16 quantities=None, 17 interpolation_points=None, 18 time_thinning=1, 19 verbose=False, 20 use_cache=False): 20 21 """Read time history of spatial data from NetCDF file and return 21 22 a callable object. … … 58 59 59 60 61 # Build arguments and keyword arguments for use with caching or apply. 62 args = (filename,) 63 64 kwargs = {'domain': domain, 65 'quantities': quantities, 66 'interpolation_points': interpolation_points, 67 'time_thinning': time_thinning, 68 'verbose': verbose} 69 70 71 # Call underlying engine with or without caching 60 72 if use_cache is True: 61 73 try: … … 66 78 raise msg 67 79 68 69 80 f = cache(_file_function, 70 filename, 71 {'domain': domain, 72 'quantities': quantities, 73 'interpolation_points': interpolation_points, 74 'verbose': verbose}, 75 dependencies = [filename], 76 compression = False, 77 verbose = verbose) 78 #FIXME (Ole): Pass cache arguments, such as compression, in some sort of 79 #structure 81 args, kwargs, 82 dependencies=[filename], 83 compression=False, 84 verbose=verbose) 85 86 else: 87 f = apply(_file_function, 88 args, kwargs) 89 90 91 #FIXME (Ole): Pass cache arguments, such as compression, in some sort of 92 #structure 80 93 81 else:82 f = _file_function(filename,83 domain,84 quantities,85 interpolation_points,86 verbose)87 94 88 95 return f … … 91 98 92 99 def _file_function(filename, 93 domain = None, 94 quantities = None, 95 interpolation_points = None, 96 verbose = False): 100 domain=None, 101 quantities=None, 102 interpolation_points=None, 103 time_thinning=1, 104 verbose=False): 97 105 """Internal function 98 106 … … 133 141 return get_netcdf_file_function(filename, domain, quantities, 134 142 interpolation_points, 143 time_thinning=time_thinning, 135 144 verbose = verbose) 136 145 else: … … 143 152 quantity_names=None, 144 153 interpolation_points=None, 154 time_thinning=1, 145 155 verbose = False): 146 156 """Read time history of spatial data from NetCDF sww file and … … 238 248 time = fid.variables['time'][:] 239 249 250 # Get time independent stuff 240 251 if spatial: 241 252 #Get origin … … 296 307 297 308 298 #Produce values for desired data points at 299 #each timestep 300 309 # Produce values for desired data points at 310 # each timestep for each quantity 301 311 quantities = {} 302 312 for i, name in enumerate(quantity_names): … … 318 328 triangles, 319 329 interpolation_points, 330 time_thinning=time_thinning, 320 331 verbose=verbose) 321 332
Note: See TracChangeset
for help on using the changeset viewer.