Changeset 3346
- Timestamp:
- Jul 18, 2006, 11:17:39 AM (19 years ago)
- Location:
- inundation/damage
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/damage/inundation_damage.py
r3337 r3346 40 40 use_cache = True): 41 41 """ 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. 42 48 """ 43 49 … … 56 62 results_dic = edm.calc_damage_and_costs(verbose_csv=True) 57 63 for title, value in results_dic.iteritems(): 58 csv.set_colum (title, value)64 csv.set_column(title, value) 59 65 60 66 # Save info back to csv file 67 if exposure_file_out == None: 68 exposure_file_out = exposure_file_in 61 69 csv.save(exposure_file_out) 62 70 … … 193 201 def __init__(self,max_depths, shore_distances, walls, 194 202 struct_costs, content_costs): 195 self.max_depths = max_depths196 self.shore_distances = shore_distances203 self.max_depths = [float(x) for x in max_depths] 204 self.shore_distances = [float(x) for x in shore_distances] 197 205 self.walls = walls 198 self.struct_costs = struct_costs199 self.content_costs = content_costs206 self.struct_costs = [float(x) for x in struct_costs] 207 self.content_costs = [float(x) for x in content_costs] 200 208 201 209 self.structure_count = len(self.max_depths) … … 255 263 256 264 def calc_cost(self): 265 # ensure_numeric does not cut it. 257 266 self.struct_loss = self.struct_damage * \ 258 267 ensure_numeric(self.struct_costs) -
inundation/damage/test_inundation_damage.py
r3337 r3346 141 141 142 142 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 144 147 sww_file = self.domain.filename + "." + self.domain.format 145 148 #print "sww_file",sww_file … … 288 291 #------------------------------------------------------------- 289 292 if __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') 292 294 suite = unittest.makeSuite(Test_inundation_damage,'test') 293 295 runner = unittest.TextTestRunner()
Note: See TracChangeset
for help on using the changeset viewer.