Changeset 7822


Ignore:
Timestamp:
Jun 11, 2010, 11:56:36 AM (14 years ago)
Author:
hudson
Message:

Improved docs for sww_merge.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/utilities/sww_merge.py

    r7820 r7822  
    1818        May be useful for parallel runs. Note that some advanced information
    1919        and custom quantities may not be exported.
     20       
     21        The sww files to be merged must have exactly the same timesteps.
     22       
     23        swwfiles is a list of .sww files to merge.
     24        output is the output filename, including .sww extension.
     25        verbose True to log output information
    2026    """
    2127   
     
    4349                out_s_quantities[quantity] = []
    4450
     51            # Quantities are stored as a 2D array of timesteps x data.
    4552            for quantity in dynamic_quantities:
    4653                out_d_quantities[quantity] = [ [] for _ in range(len(times))]
     
    5057        else:
    5158            for tri in tris:
     59                # Advance new tri indices to point at newly appended points.
    5260                verts = [vertex+tri_offset for vertex in tri]
    5361                out_tris.append(verts)
     
    6270        y.extend(list(fid.variables['y'][:]))
    6371       
     72        # Grow the list of static quantities associated with the x,y points
    6473        for quantity in static_quantities:
    6574            out_s_quantities[quantity].extend(fid.variables[quantity][:])
    6675           
     76        #Collate all dynamic quantities according to their timestep
    6777        for quantity in dynamic_quantities:
    6878            time_chunks = fid.variables[quantity][:]
    6979            for i, time_chunk in enumerate(time_chunks):
    7080                out_d_quantities[quantity][i].extend(time_chunk)           
    71        
     81   
     82    # Mash all points into a single big list   
    7283    points = [[xx, yy] for xx, yy in zip(x, y)]
    7384    fid.close()
    7485   
    75     # NetCDF file definition
     86    # Write out the SWW file
    7687    fido = NetCDFFile(output, netcdf_mode_w)
    7788    sww = Write_sww(static_quantities, dynamic_quantities)
     
    8798    sww.store_static_quantities(fido, verbose=verbose, **out_s_quantities)
    8899
     100    # Write out all the dynamic quantities for each timestep
    89101    for q in dynamic_quantities:
    90102        q_values = out_d_quantities[q]
Note: See TracChangeset for help on using the changeset viewer.