Changeset 7572
- Timestamp:
- Nov 26, 2009, 2:02:35 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/production/new_south_wales/batemans_bay/compare_inundation_areas.py
r7570 r7572 13 13 from os.path import join 14 14 from collections import defaultdict 15 import csv 16 17 18 15 19 # Create the Geoprocessor object 16 20 gp = arcgisscripting.create(9.3) … … 30 34 boundary_path = "N:\\georisk_models\\inundation\\data\\new_south_wales\\batemans_bay_tsunami_scenario_2009\\anuga\\boundaries\\" 31 35 boundary_file_name = 'wave_energy_summary.csv' 36 out_file_name = 'area_comparisons.csv' 37 #figure = 'area_comparisons.png' 38 32 39 boundary_file = join(boundary_path,boundary_file_name) 40 out_file = join(boundary_path, out_file_name) 41 #figure_path = join(boundary_path, 'figures',figure) 42 plot = True 33 43 34 44 event_dict = {'Event1_MSL':58346, 35 'Event1_HAT':58346,36 ##'Event2_MSL':51204,45 ## 'Event1_HAT':58346, 46 'Event2_MSL':51204, 37 47 ## 'Event2_HAT':51204, 38 'Event3_MSL':58284 }#,48 'Event3_MSL':58284,#, 39 49 ## 'Event3_HAT':58284, 40 ##'Puysegur_200yr':58129,41 ##'Puysegur_500yr':58115,42 ##'Puysegur_1000yr':58226,43 ##'Puysegur_5000yr':58286,44 ##'Puysegur_15000yr':58272,45 ##'New_Hebrides_200yr':51077,46 ##'New_Hebrides_500yr':51378,47 ##'New_Hebrides_1000yr':51347,48 ##'New_Hebrides_2000yr':51292,49 ##'New_Hebrides_5000yr':51424,}50 51 # Dictionar yfor storing area comparison50 'Puysegur_200yr':58129, 51 'Puysegur_500yr':58115, 52 'Puysegur_1000yr':58226, 53 'Puysegur_5000yr':58286, 54 'Puysegur_15000yr':58272, 55 'New_Hebrides_200yr':51077, 56 'New_Hebrides_500yr':51378, 57 'New_Hebrides_1000yr':51347, 58 'New_Hebrides_2000yr':51292, 59 'New_Hebrides_5000yr':51424,} 60 61 # Dictionaries for storing area comparison 52 62 area_comp = defaultdict(list) 63 area_percent = defaultdict(list) 53 64 54 65 boundaries = file(boundary_file,'r') … … 236 247 237 248 for key in anuga_area_dict: 249 if not key in analytical_area_dict: 250 analytical_area_dict[key] = 0. 238 251 diff = anuga_area_dict[key]-analytical_area_dict[key] 252 percent_diff = 100*diff/anuga_area_dict[key] 239 253 area_comp[key].append(diff) 240 print 'area_comp', area_comp 241 254 area_percent[key].append(percent_diff) 255 print 'area_comp', area_comp 256 print 'area_percent', area_percent 257 258 ##csv_dict = csv.DictWriter(open(out_file,'w'),[1,2,3,4,5,6,7,8,9]) 259 ##csv_dict.writerow(dict(zip([1,2,3,4,5,6,7,8,9],[1,2,3,4,5,6,7,8,9]))) 260 ##csv_dict.writerow(area_percent) 261 262 csv_out = csv.writer(open(out_file,'w')) 263 csv_out.writerow([1,2,3,4,5,6,7,8,9]) 264 for i in range(len(area_percent[1])): 265 value_list =[] 266 for key in area_percent: 267 value_list.append(area_percent[key][i]) 268 csv_out.writerow(value_list) 269 270 out_file.close() 271 ##for key, value in area_percent: 272 ## key_list = [] 273 ## for val in value: 274 ## key_list.append(key) 275 ## pylab.scatter(key_list,value) 276 277 278 279 280 242 281 boundaries.close() 282 283
Note: See TracChangeset
for help on using the changeset viewer.