Changeset 3346


Ignore:
Timestamp:
Jul 18, 2006, 11:17:39 AM (19 years ago)
Author:
duncan
Message:

bug fixes

Location:
inundation/damage
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • inundation/damage/inundation_damage.py

    r3337 r3346  
    4040                                 use_cache = True):
    4141    """
     42    This is the main function for calculating tsunami damage due to
     43    inundation.  It gets the location of structures from the exposure
     44    file and gets the inundation of these structures from the
     45    sww file.
     46
     47    It then calculates the damage loss.
    4248    """
    4349
     
    5662    results_dic = edm.calc_damage_and_costs(verbose_csv=True)
    5763    for title, value in results_dic.iteritems():
    58         csv.set_colum(title, value)
     64        csv.set_column(title, value)
    5965   
    6066    # Save info back to csv file
     67    if exposure_file_out == None:
     68        exposure_file_out = exposure_file_in
    6169    csv.save(exposure_file_out)
    6270   
     
    193201    def __init__(self,max_depths, shore_distances, walls,
    194202                 struct_costs, content_costs):
    195         self.max_depths = max_depths
    196         self.shore_distances = shore_distances
     203        self.max_depths = [float(x) for x in max_depths]
     204        self.shore_distances = [float(x) for x in shore_distances]
    197205        self.walls = walls
    198         self.struct_costs = struct_costs
    199         self.content_costs = content_costs
     206        self.struct_costs = [float(x) for x in struct_costs]
     207        self.content_costs = [float(x) for x in content_costs]
    200208
    201209        self.structure_count = len(self.max_depths)
     
    255263       
    256264    def calc_cost(self):
     265        # ensure_numeric does not cut it.
    257266        self.struct_loss = self.struct_damage * \
    258267                           ensure_numeric(self.struct_costs)
  • inundation/damage/test_inundation_damage.py

    r3337 r3346  
    141141
    142142   
    143     def ztest_inundation_damage(self):
     143    def test_inundation_damage(self):
     144
     145        # Note, this isn't testing the results,
     146        # just that is all runs
    144147        sww_file = self.domain.filename + "." + self.domain.format
    145148        #print "sww_file",sww_file
     
    288291#-------------------------------------------------------------
    289292if __name__ == "__main__":
    290     #suite = unittest.makeSuite(Test_inundation_damage,'test_add_depth_and_momentum2csv')
    291     #suite = unittest.makeSuite(Test_inundation_damage,'test_calc_damage_and_costs')
     293    #suite = unittest.makeSuite(Test_inundation_damage,'test_inundation_damage')
    292294    suite = unittest.makeSuite(Test_inundation_damage,'test')
    293295    runner = unittest.TextTestRunner()
Note: See TracChangeset for help on using the changeset viewer.