Changeset 7574


Ignore:
Timestamp:
Dec 2, 2009, 5:35:02 PM (14 years ago)
Author:
ole
Message:

Comments about timestep and reduction is sww2dem

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/shallow_water/data_manager.py

    r7569 r7574  
    22732273        quantity = 'elevation'
    22742274
     2275    # FIXME (Ole): I reckon we need a check so that
     2276    # reduction and timestep cannot both be set.   
     2277    # if reduction is not None and timestep is not None:
     2278    #     msg = 'Either reduction or timestep must be set'
     2279    #     msg += ' but not both.'
     2280    #     raise Exception(msg)
     2281   
     2282   
    22752283    if reduction is None:
    22762284        reduction = max
     
    23522360                         % (min(times), max(times), len(times)))
    23532361        log.critical('  Quantities [SI units]:')
     2362       
    23542363        # Comment out for reduced memory consumption
    23552364        for name in ['stage', 'xmomentum', 'ymomentum']:
     
    23842393
    23852394    for start_slice in xrange(0, number_of_points, block_size):
    2386         # limit slice size to array end if at last block
     2395        # Limit slice size to array end if at last block
    23872396        end_slice = min(start_slice + block_size, number_of_points)
    23882397       
    2389         # get slices of all required variables
     2398        # Get slices of all required variables
    23902399        q_dict = {}
    23912400        for name in var_list:
     
    24022411            new_res = num.zeros(res.shape[1], num.float)
    24032412            for k in xrange(res.shape[1]):
    2404                 if reduction == None:
     2413                if reduction is None:
    24052414                    new_res[k] = res[timestep,k]
    24062415                else:
     
    24102419        result[start_slice:end_slice] = res
    24112420                                   
    2412     #Post condition: Now q has dimension: number_of_points
     2421    # Post condition: Now q has dimension: number_of_points
    24132422    assert len(result.shape) == 1
    24142423    assert result.shape[0] == number_of_points
     
    24182427                     % (quantity, min(result), max(result)))
    24192428
    2420     #Create grid and update xll/yll corner and x,y
    2421     #Relative extent
     2429    # Create grid and update xll/yll corner and x,y
     2430    # Relative extent
    24222431    if easting_min is None:
    24232432        xmin = min(x)
     
    24522461    nrows = int((ymax-ymin)/cellsize) + 1
    24532462
    2454     #New absolute reference and coordinates
     2463    # New absolute reference and coordinates
    24552464    newxllcorner = xmin + xllcorner
    24562465    newyllcorner = ymin + yllcorner
     
    24682477            yg = i * cellsize
    24692478        else:
    2470         #this will flip the order of the y values for ers
     2479            # this will flip the order of the y values for ers
    24712480            yg = (nrows-i) * cellsize
    24722481
     
    24782487            grid_points[k, 1] = yg
    24792488
    2480     #Interpolate
     2489    # Interpolate
    24812490    from anuga.fit_interpolate.interpolate import Interpolate
    24822491
    24832492    # Remove loners from vertex_points, volumes here
    24842493    vertex_points, volumes = remove_lone_verts(vertex_points, volumes)
    2485     #export_mesh_file('monkey.tsh',{'vertices':vertex_points, 'triangles':volumes})
    2486     #import sys; sys.exit()
     2494    # export_mesh_file('monkey.tsh',{'vertices':vertex_points, 'triangles':volumes})
    24872495    interp = Interpolate(vertex_points, volumes, verbose = verbose)
    24882496
    2489     #Interpolate using quantity values
     2497    # Interpolate using quantity values
    24902498    if verbose: log.critical('Interpolating')
    24912499    grid_values = interp.interpolate(result, grid_points).flatten()
     
    24952503                     % (num.min(grid_values), num.max(grid_values)))
    24962504
    2497     #Assign NODATA_value to all points outside bounding polygon (from interpolation mesh)
     2505    # Assign NODATA_value to all points outside bounding polygon (from interpolation mesh)
    24982506    P = interp.mesh.get_boundary_polygon()
    24992507    outside_indices = outside_polygon(grid_points, P, closed=True)
     
    25882596
    25892597################################################################################
    2590 # Obsolete functions - mainatined for backwards compatibility
     2598# Obsolete functions - maintained for backwards compatibility
    25912599################################################################################
    25922600
Note: See TracChangeset for help on using the changeset viewer.