Ignore:
Timestamp:
Oct 14, 2005, 11:26:21 AM (19 years ago)
Author:
ole
Message:

Implemented arbitrary expressions for sww2dem using code from changeset:1916

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/pyvolution/data_manager.py

    r1911 r1919  
    12481248
    12491249
    1250     if quantity is given, out values from quantity otherwise default to
    1251     elevation
     1250    The parameter quantity must be the name of an existing quantity or
     1251    an expression involving existing quantities. The default is
     1252    'elevation'.
    12521253
    12531254    if timestep (an index) is given, output quantity at that timestep
     
    12621263    from Numeric import array, Float, concatenate, NewAxis, zeros, reshape, sometrue
    12631264    from utilities.polygon import inside_polygon
     1265    from util import apply_expression_to_dictionary
    12641266   
    12651267    msg = 'Format must be either asc or ers'
     
    13151317
    13161318    #Get quantity and reduce if applicable
    1317     if verbose: print 'Reading quantity %s' %quantity
    1318 
    1319     if quantity.lower() == 'depth':
    1320         q = fid.variables['stage'][:] - fid.variables['elevation'][:]
    1321     else:
    1322         q = fid.variables[quantity][:]
     1319    if verbose: print 'Processing quantity %s' %quantity
     1320
     1321    #Turn NetCDF objects into Numeric arrays
     1322    quantity_dict = {}
     1323    for name in fid.variables.keys():
     1324
     1325        if name not in ['x', 'y', 'volumes', 'time']:
     1326            quantity_dict[name] = fid.variables[name][:]
     1327
     1328    #print quantity_dict     
     1329   
     1330
     1331    q = apply_expression_to_dictionary(quantity, quantity_dict)
    13231332
    13241333
Note: See TracChangeset for help on using the changeset viewer.