Changeset 8847
- Timestamp:
- Apr 22, 2013, 2:59:58 PM (12 years ago)
- Location:
- trunk/anuga_core/source/anuga
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/abstract_2d_finite_volumes/quantity_ext.c
r8690 r8847 1531 1531 1532 1532 // Release 1533 Py_DECREF(domain); 1533 1534 Py_DECREF(domain_centroids); 1534 1535 Py_DECREF(domain_surrogate_neighbours); -
trunk/anuga_core/source/anuga/file_conversion/calc_grid_values_ext.c
r8634 r8847 412 412 long *volumes; 413 413 double nodata_val; 414 414 double cell_size; 415 415 double *x, *y; 416 416 double *norms; 417 417 double *result; 418 418 double *grid_val; 419 419 PyObject *pyobj_x; 420 421 420 PyObject *pyobj_y; 421 PyObject *pyobj_norms; 422 422 PyObject *pyobj_volumes; 423 423 PyObject *pyobj_result; … … 427 427 &nrow, 428 428 &ncol, 429 429 &cell_size, 430 430 &nodata_val, 431 431 &pyobj_x, 432 433 432 &pyobj_y, 433 &pyobj_norms, 434 434 &pyobj_volumes, 435 435 &pyobj_result, … … 446 446 // get data from python objects 447 447 x = DDATA( pyobj_x ); 448 449 448 y = DDATA( pyobj_y ); 449 norms = DDATA( pyobj_norms ); 450 450 result = DDATA( pyobj_result ); 451 451 grid_val = DDATA( pyobj_grid_val ); … … 455 455 num_tri = ((PyArrayObject*)pyobj_volumes)->dimensions[0]; 456 456 num_vert = ((PyArrayObject*)pyobj_x)->dimensions[0]; 457 458 459 460 457 num_norms = ((PyArrayObject*)pyobj_norms)->dimensions[0]; 458 num_grid_val = ((PyArrayObject*)pyobj_grid_val)->dimensions[0]; 459 460 //printf("==== %d %d %d %d %d \n",num_norms,num_tri,num_vert,nrow,ncol); 461 461 462 462 // init triangle array -
trunk/anuga_core/source/anuga/file_conversion/sww2array.py
r8780 r8847 27 27 28 28 # Default block size for sww2dem() 29 DEFAULT_BLOCK_SIZE = 10000 29 DEFAULT_BLOCK_SIZE = 100000 30 30 31 31 def sww2array(name_in, … … 197 197 198 198 # Get slices of all required variables 199 q_dict = {} 200 for name in var_list: 201 # check if variable has time axis 202 if len(fid.variables[name].shape) == 2: 203 q_dict[name] = fid.variables[name][:,start_slice:end_slice] 204 else: # no time axis 205 q_dict[name] = fid.variables[name][start_slice:end_slice] 206 207 # Evaluate expression with quantities found in SWW file 208 res = apply_expression_to_dictionary(quantity, q_dict) 209 210 if len(res.shape) == 2: 211 new_res = num.zeros(res.shape[1], num.float) 212 for k in xrange(res.shape[1]): 213 if type(reduction) is not types.BuiltinFunctionType: 214 new_res[k] = res[reduction,k] 215 else: 216 new_res[k] = reduction(res[:,k]) 217 res = new_res 199 if type(reduction) is not types.BuiltinFunctionType: 200 q_dict = {} 201 for name in var_list: 202 # check if variable has time axis 203 if len(fid.variables[name].shape) == 2: 204 print 'avoiding large array' 205 q_dict[name] = fid.variables[name][reduction,start_slice:end_slice] 206 else: # no time axis 207 q_dict[name] = fid.variables[name][start_slice:end_slice] 208 209 # Evaluate expression with quantities found in SWW file 210 res = apply_expression_to_dictionary(quantity, q_dict) 211 212 # if len(res.shape) == 2: 213 # new_res = num.zeros(res.shape[1], num.float) 214 # for k in xrange(res.shape[1]): 215 # if type(reduction) is not types.BuiltinFunctionType: 216 # new_res[k] = res[k] 217 # else: 218 # new_res[k] = reduction(res[:,k]) 219 # res = new_res 220 else: 221 q_dict = {} 222 for name in var_list: 223 # check if variable has time axis 224 if len(fid.variables[name].shape) == 2: 225 q_dict[name] = fid.variables[name][:,start_slice:end_slice] 226 else: # no time axis 227 q_dict[name] = fid.variables[name][start_slice:end_slice] 228 229 # Evaluate expression with quantities found in SWW file 230 res = apply_expression_to_dictionary(quantity, q_dict) 231 232 if len(res.shape) == 2: 233 new_res = num.zeros(res.shape[1], num.float) 234 for k in xrange(res.shape[1]): 235 if type(reduction) is not types.BuiltinFunctionType: 236 new_res[k] = res[reduction,k] 237 else: 238 new_res[k] = reduction(res[:,k]) 239 res = new_res 218 240 219 241 result[start_slice:end_slice] = res … … 282 304 283 305 284 306 fid.close() 307 285 308 #print outside_indices 286 309
Note: See TracChangeset
for help on using the changeset viewer.