Changeset 8816


Ignore:
Timestamp:
Apr 5, 2013, 8:54:18 PM (12 years ago)
Author:
steve
Message:

Getting inundation_damage to work with scipy

Location:
trunk/anuga_core/source
Files:
2 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/damage_modelling/inundation_damage.py

    r8249 r8816  
    66import os
    77from math import sqrt
    8 from Scientific.Functions.Interpolation import InterpolatingFunction
     8#from Scientific.Functions.Interpolation import InterpolatingFunction
     9from scipy.interpolate import interp1d
    910from random import choice
    1011
     
    208209    STRUCT_COLLAPSED_TITLE = "STRUCT_COLLAPSED"#"collapsed structure if 1"
    209210    STRUCT_INUNDATED_TITLE = "STRUCT_INUNDATED"#"inundated structure if 1"
    210     double_brick_damage_array = num.array([[-kinds.default_float_kind.MAX, 0.0],
     211    double_brick_damage_array = num.array([#[-kinds.default_float_kind.MAX, 0.0],
     212                                           [-1000.0, 0.0],
    211213                                           [0.0-depth_epsilon, 0.0],
    212214                                           [0.0,0.016],
     
    218220                                           [2.0,0.587],
    219221                                           [2.5,0.647],
    220                                            [kinds.default_float_kind.MAX,64.7]])
    221     double_brick_damage_curve = InterpolatingFunction( \
    222         (num.ravel(double_brick_damage_array[:,0:1]),),
    223         num.ravel(double_brick_damage_array[:,1:]))
    224    
    225     brick_veeer_damage_array = num.array([[-kinds.default_float_kind.MAX, 0.0],
     222                                           [1000.0, 64.7]
     223                                           #[kinds.default_float_kind.MAX,64.7]
     224                                           ])
     225    #double_brick_damage_curve = InterpolatingFunction( \
     226    #    (num.ravel(double_brick_damage_array[:,0:1]),),
     227    #    num.ravel(double_brick_damage_array[:,1:]))
     228    double_brick_damage_curve = interp1d(double_brick_damage_array[:,0],double_brick_damage_array[:,1])
     229   
     230    brick_veeer_damage_array = num.array([#[-kinds.default_float_kind.MAX, 0.0],
     231                                          [-1000.0,0.0],
    226232                                          [0.0-depth_epsilon, 0.0],
    227233                                          [0.0,0.016],
     
    233239                                          [2.0,0.633],
    234240                                          [2.5,0.694],
    235                                           [kinds.default_float_kind.MAX,69.4]])
    236     brick_veeer_damage_curve = InterpolatingFunction( \
    237         (num.ravel(brick_veeer_damage_array[:,0:1]),),
    238         num.ravel(brick_veeer_damage_array[:,1:]))
     241                                          [1000.0,69.4]
     242                                          #[kinds.default_float_kind.MAX,69.4]
     243                                          ])
     244    #brick_veeer_damage_curve = InterpolatingFunction( \
     245    #    (num.ravel(brick_veeer_damage_array[:,0:1]),),
     246    #    num.ravel(brick_veeer_damage_array[:,1:]))
     247
     248    brick_veeer_damage_curve = interp1d(brick_veeer_damage_array[:,0],brick_veeer_damage_array[:,1])
     249
    239250    struct_damage_curve = {'Double Brick':double_brick_damage_curve,
    240251                           'Brick Veneer':brick_veeer_damage_curve}
    241252    default_struct_damage_curve = brick_veeer_damage_curve
    242253
    243     contents_damage_array = num.array([[-kinds.default_float_kind.MAX, 0.0],
     254    contents_damage_array = num.array([#[-kinds.default_float_kind.MAX, 0.0],
     255                                       [-1000.0,0.0],
    244256                                       [0.0-depth_epsilon, 0.0],
    245257                                       [0.0,0.013],
     
    250262                                       [1.5,0.976],
    251263                                       [2.0,0.986],
    252                                        [kinds.default_float_kind.MAX,98.6]])
    253     contents_damage_curve = InterpolatingFunction( \
    254         (num.ravel(contents_damage_array[:,0:1]),),
    255         num.ravel(contents_damage_array[:,1:]))
    256 
     264                                       [1000.0,98.6]
     265                                       #[kinds.default_float_kind.MAX,98.6]
     266                                       ])
     267    #contents_damage_curve = InterpolatingFunction( \
     268    #    (num.ravel(contents_damage_array[:,0:1]),),
     269    #    num.ravel(contents_damage_array[:,1:]))
     270
     271    contents_damage_curve = interp1d(contents_damage_array[:,0],contents_damage_array[:,1])
    257272    #building collapse probability
    258273    # inundation depth above ground floor, m
  • trunk/anuga_core/source/anuga/test_all.py

    r8813 r8816  
    3333
    3434# Directories that should not be searched for test files.
    35 exclude_dirs = ['shallow_water_balanced' , 'damage_modelling', # Special requirements
     35exclude_dirs = ['shallow_water_balanced' , #'damage_modelling', # Special requirements
    3636                '.svn',          # subversion
    3737                'props', 'wcprops', 'prop-base', 'text-base', 'tmp']
     
    197197    from optparse import OptionParser
    198198
     199    import os
     200    for file in os.listdir('.'):
     201        if file.endswith('.sww') or\
     202                file.endswith('.msh') or\
     203                file.endswith('.csv') or\
     204                file.endswith('.asc') or\
     205                file.endswith('.prj') or\
     206                file.endswith('.tsh') or\
     207                file.endswith('.sts') or\
     208                file.endswith('.tms') or\
     209                file.endswith('.txt'):
     210            os.remove(file)
     211
    199212    check_anuga_import()
    200213
     
    238251        #os.remove(filename)
    239252   
    240     #if sys.platform == 'win32':
    241     #    raw_input('Press the RETURN key')
     253
     254
     255    import os
     256    for file in os.listdir('.'):
     257        if file.endswith('.sww') or\
     258                file.endswith('.msh') or\
     259                file.endswith('.csv') or\
     260                file.endswith('.asc') or\
     261                file.endswith('.prj') or\
     262                file.endswith('.tsh') or\
     263                file.endswith('.sts') or\
     264                file.endswith('.tms') or\
     265                file.endswith('.txt'):
     266            try:
     267                os.remove(file)
     268            except:
     269                pass
     270           
  • trunk/anuga_core/source/anuga_validation_tests/Analytical_exact/dam_break_wet

    • Property svn:ignore
      •  

        old new  
        11.deps
         2.python_cache
Note: See TracChangeset for help on using the changeset viewer.