Changeset 3355


Ignore:
Timestamp:
Jul 18, 2006, 3:52:01 PM (18 years ago)
Author:
duncan
Message:

Adding more info to the csv file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/damage/inundation_damage.py

    r3352 r3355  
    6262                           csv.get_column('C_VALUE')
    6363                           )
    64     results_dic = edm.calc_damage_and_costs(verbose_csv=True)
     64    results_dic = edm.calc_damage_and_costs(verbose_csv=True, verbose=verbose)
    6565    for title, value in results_dic.iteritems():
    6666        csv.set_column(title, value, overwrite=overwrite)
     
    142142    COLLAPSE_CSV_INFO_TITLE = "Calculation notes"
    143143    MAX_DEPTH_TITLE = "Inundation height above ground floor (m)"
     144    STRUCT_COLLAPSED_TITLE = "1 if structure collapsed"
     145    STRUCT_INUNDATED_TITLE = "1 if structure is inundated"
    144146    double_brick_damage_array = array([[-kinds.default_float_kind.MAX, 0.0],
    145147                                       [0.0-depth_epsilon, 0.0],
     
    222224        #assert  self.structure_count == len(self.)
    223225       
    224     def calc_damage_and_costs(self, verbose_csv=False):
     226    def calc_damage_and_costs(self, verbose_csv=False, verbose=False):
    225227        self.calc_damage_percentages()
    226228        collapse_probability = self.calc_collapse_probability()
     
    233235                        ,self.CONTENTS_DAMAGE_TITLE:self.contents_damage
    234236                        ,self.MAX_DEPTH_TITLE:self.max_depths
    235                         #,self.:self.
    236                         #,self.:self.
     237                        ,self.STRUCT_COLLAPSED_TITLE:self.struct_collapsed
     238                        ,self.STRUCT_INUNDATED_TITLE:self.struct_inundated
    237239                        }
    238240        if verbose_csv:
     
    245247        struct_damage = zeros(self.structure_count,Float)
    246248        contents_damage = zeros(self.structure_count,Float)
    247         #for i_building,
     249        self.struct_inundated = ['']* self.structure_count
    248250
    249251        for i,max_depth,shore_distance,wall in map(None,
     
    259261            if 0.0 > max_depth:
    260262                continue
     263           
     264            # The definition of inundated is if the max_depth is > 0.0
     265            self.struct_inundated[i] = 1.0
     266           
    261267            #calc structural damage %
    262268            damage_curve = self.struct_damage_curve.get(wall,
     
    330336        and collapse some houses
    331337        """
     338       
     339        self.struct_collapsed = ['']* self.structure_count
    332340        if verbose_csv:
    333341            self.collapse_csv_info = ['']* self.structure_count
     
    347355                self.contents_damage[house_index] = 1.0
    348356                house_indexes.remove(house_index)
     357                self.struct_collapsed[house_index] = 1
     358               
    349359            # Warning, the collapse_probability list now lists
    350360            # houses that did not collapse, (though not all of them)
Note: See TracChangeset for help on using the changeset viewer.