Changeset 3961


Ignore:
Timestamp:
Nov 9, 2006, 5:01:09 PM (16 years ago)
Author:
sexton
Message:

allow sww2dem to work on a given timestep (rather than maximise or minimise across all time)

File:
1 edited

Legend:

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

    r3954 r3961  
    18741874    y = fid.variables['y'][:]
    18751875    volumes = fid.variables['volumes'][:]
     1876    times = fid.variables['time'][:]
     1877    if timestep is not None:
     1878        times = fid.variables['time'][timestep]
    18761879
    18771880    number_of_timesteps = fid.dimensions['number_of_timesteps']
     
    18991902    #Something like print swwstats(swwname)
    19001903    if verbose:
    1901         x = fid.variables['x'][:]
    1902         y = fid.variables['y'][:]
    1903         times = fid.variables['time'][:]
    19041904        print '------------------------------------------------'
    19051905        print 'Statistics of SWW file:'
     
    19081908        print '    Lower left corner: [%f, %f]'\
    19091909              %(xllcorner, yllcorner)
    1910         print '    Start time: %f' %fid.starttime[0]
     1910        if timestep is not None:
     1911            print '    Time: %f' %(times)
     1912        else:
     1913            print '    Start time: %f' %fid.starttime[0]
    19111914        print '  Extent:'
    19121915        print '    x [m] in [%f, %f], len(x) == %d'\
     
    19141917        print '    y [m] in [%f, %f], len(y) == %d'\
    19151918              %(min(y.flat), max(y.flat), len(y.flat))
    1916         print '    t [s] in [%f, %f], len(t) == %d'\
    1917               %(min(times), max(times), len(times))
     1919        if timestep is not None:
     1920            print '    t [s] = %f, len(t) == %d' %(times, 1)
     1921        else:
     1922            print '    t [s] in [%f, %f], len(t) == %d'\
     1923                  %(min(times), max(times), len(times))
    19181924        print '  Quantities [SI units]:'
    19191925        for name in ['stage', 'xmomentum', 'ymomentum', 'elevation']:
     
    19221928
    19231929
    1924 
    1925 
    1926 
    19271930    # Get quantity and reduce if applicable
    19281931    if verbose: print 'Processing quantity %s' %quantity
     
    19341937
    19351938
    1936 
    19371939    # Convert quantity expression to quantities found in sww file   
    19381940    q = apply_expression_to_dictionary(quantity, quantity_dict)
    1939 
    1940 
    19411941
    19421942    if len(q.shape) == 2:
     
    19961996    x = x+xllcorner-newxllcorner
    19971997    y = y+yllcorner-newyllcorner
    1998 
     1998   
    19991999    vertex_points = concatenate ((x[:, NewAxis] ,y[:, NewAxis]), axis = 1)
    20002000    assert len(vertex_points.shape) == 2
    2001 
    2002 
    20032001
    20042002    grid_points = zeros ( (ncols*nrows, 2), Float )
     
    20232021    from anuga.fit_interpolate.interpolate import Interpolate
    20242022
    2025 
     2023    print 'hello', vertex_points.shape, volumes.shape
    20262024    interp = Interpolate(vertex_points, volumes, verbose = verbose)
    2027 
    2028 
    20292025
    20302026    #Interpolate using quantity values
Note: See TracChangeset for help on using the changeset viewer.