Changeset 3967


Ignore:
Timestamp:
Nov 13, 2006, 10:23:07 AM (18 years ago)
Author:
sexton
Message:

update sww2dem so that export can occur at given timestep

File:
1 edited

Legend:

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

    r3964 r3967  
    18741874    y = fid.variables['y'][:]
    18751875    volumes = fid.variables['volumes'][:]
    1876     times = fid.variables['time'][:]
    18771876    if timestep is not None:
    18781877        times = fid.variables['time'][timestep]
     1878    else:
     1879        times = fid.variables['time'][:]
    18791880
    18801881    number_of_timesteps = fid.dimensions['number_of_timesteps']
    18811882    number_of_points = fid.dimensions['number_of_points']
     1883   
    18821884    if origin is None:
    18831885
     
    19211923        else:
    19221924            print '    t [s] in [%f, %f], len(t) == %d'\
    1923                   %(min(times), max(times), len(times))
     1925              %(min(times), max(times), len(times))
    19241926        print '  Quantities [SI units]:'
    1925         for name in ['stage', 'xmomentum', 'ymomentum', 'elevation']:
     1927        for name in ['stage', 'xmomentum', 'ymomentum']:
    19261928            q = fid.variables[name][:].flat
    1927             print '    %s in [%f, %f]' %(name, min(q), max(q))
    1928 
    1929 
     1929            if timestep is not None:
     1930                q = q[timestep*len(x):(timestep+1)*len(x)]
     1931            if verbose: print '    %s in [%f, %f]' %(name, min(q), max(q))
     1932        for name in ['elevation']:
     1933            q = fid.variables[name][:].flat
     1934            if verbose: print '    %s in [%f, %f]' %(name, min(q), max(q))
     1935           
    19301936    # Get quantity and reduce if applicable
    19311937    if verbose: print 'Processing quantity %s' %quantity
     
    19341940    quantity_dict = {}
    19351941    for name in fid.variables.keys():
    1936         quantity_dict[name] = fid.variables[name][:]
     1942        quantity_dict[name] = fid.variables[name][:] 
    19371943
    19381944
     
    19451951        if verbose: print 'Reducing quantity %s' %quantity
    19461952        q_reduced = zeros( number_of_points, Float )
    1947 
    1948         for k in range(number_of_points):
    1949             q_reduced[k] = reduction( q[:,k] )
     1953       
     1954        if timestep is not None:
     1955            for k in range(number_of_points):
     1956                q_reduced[k] = q[timestep,k]
     1957        else:
     1958            for k in range(number_of_points):
     1959                q_reduced[k] = reduction( q[:,k] )
    19501960
    19511961        q = q_reduced
Note: See TracChangeset for help on using the changeset viewer.