[3627] | 1 | """Common filenames and locations for topographic data, meshes and outputs. |
---|
| 2 | """ |
---|
| 3 | |
---|
[4147] | 4 | from os import sep, environ, getenv, getcwd |
---|
| 5 | from os.path import expanduser |
---|
[3802] | 6 | import sys |
---|
[4147] | 7 | from time import localtime, strftime, gmtime |
---|
[4856] | 8 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon, number_mesh_triangles |
---|
[4177] | 9 | from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees, convert_from_latlon_to_utm |
---|
[3937] | 10 | from anuga.utilities.system_tools import get_user_name |
---|
[3627] | 11 | |
---|
[3828] | 12 | # file and system info |
---|
| 13 | #--------------------------------- |
---|
[3627] | 14 | codename = 'project.py' |
---|
| 15 | |
---|
| 16 | home = getenv('INUNDATIONHOME') #Sandpit's parent dir |
---|
[3937] | 17 | user = get_user_name() |
---|
[3627] | 18 | |
---|
[3669] | 19 | # INUNDATIONHOME is the inundation directory, not the data directory. |
---|
| 20 | home += sep +'data' |
---|
[3627] | 21 | |
---|
[4147] | 22 | #time stuff |
---|
[4422] | 23 | time = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir |
---|
| 24 | #time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir |
---|
[4147] | 25 | gtime = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir |
---|
| 26 | build_time = time+'_build' |
---|
| 27 | run_time = time+'_run' |
---|
[4282] | 28 | temp_time = time+'_temp' |
---|
[4147] | 29 | print 'gtime: ', gtime |
---|
[3828] | 30 | |
---|
[4373] | 31 | #tide = -2.5 |
---|
| 32 | #tide = 0.0 |
---|
[4430] | 33 | #tide = 2.4 |
---|
| 34 | tide = 200.0 |
---|
[4147] | 35 | #Making assumptions about the location of scenario data |
---|
| 36 | state = 'western_australia' |
---|
| 37 | scenario_name = 'dampier' |
---|
| 38 | scenario = 'dampier_tsunami_scenario_2006' |
---|
[3828] | 39 | |
---|
[4147] | 40 | # onshore data provided by WA DLI |
---|
[4196] | 41 | onshore_name = 'DLI_DTED_raster_clipped' # original |
---|
[3940] | 42 | |
---|
[4147] | 43 | # AHO + DPI data + colin French coastline |
---|
[4196] | 44 | coast_name = 'coastline_edited_w_DEM' |
---|
| 45 | offshore_name = 'clipped_bathy' |
---|
[4212] | 46 | offshore1_name = 'elev_501' |
---|
| 47 | offshore2_name = 'inferrec_e' |
---|
[4147] | 48 | |
---|
| 49 | #final topo name |
---|
[3828] | 50 | combined_name ='dampier_combined_elevation' |
---|
[4282] | 51 | combined_smaller_name = 'dampier_combined_elevation_small' |
---|
| 52 | combined_smallest_name = 'dampier_combined_elevation_smallest' |
---|
[3828] | 53 | |
---|
[4177] | 54 | topographies_in_dir = home+sep+state+sep+scenario+sep+'elevation_final'+sep+'070112'+sep+'points'+sep |
---|
[4147] | 55 | topographies_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'topographies'+sep |
---|
[3851] | 56 | topographies_time_dir = topographies_dir+build_time+sep |
---|
[3627] | 57 | |
---|
[4282] | 58 | temp_dir = home+sep+state+sep+scenario+sep+'anuga'+sep |
---|
| 59 | temp_dir_name = temp_dir + temp_time+sep |
---|
| 60 | |
---|
[4147] | 61 | # input topo file location |
---|
| 62 | onshore_in_dir_name = topographies_in_dir + onshore_name |
---|
| 63 | coast_in_dir_name = topographies_in_dir + coast_name |
---|
| 64 | offshore_in_dir_name = topographies_in_dir + offshore_name |
---|
[4212] | 65 | offshore1_in_dir_name = topographies_in_dir + offshore1_name |
---|
| 66 | offshore2_in_dir_name = topographies_in_dir + offshore2_name |
---|
[3828] | 67 | |
---|
[4147] | 68 | onshore_dir_name = topographies_dir + onshore_name |
---|
[3828] | 69 | coast_dir_name = topographies_dir + coast_name |
---|
| 70 | offshore_dir_name = topographies_dir + offshore_name |
---|
[4212] | 71 | offshore1_dir_name = topographies_dir + offshore1_name |
---|
| 72 | offshore2_dir_name = topographies_dir + offshore2_name |
---|
[3627] | 73 | |
---|
[4147] | 74 | #final topo files |
---|
| 75 | combined_dir_name = topographies_dir + combined_name |
---|
| 76 | combined_time_dir_name = topographies_time_dir + combined_name |
---|
[4282] | 77 | combined_smaller_dir_name = topographies_dir + combined_smaller_name |
---|
| 78 | combined_smallest_dir_name = topographies_dir + combined_smallest_name |
---|
[4147] | 79 | #combined_time_dir_final_name = topographies_time_dir + combined_final_name |
---|
[3940] | 80 | |
---|
[4147] | 81 | meshes_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'meshes'+sep |
---|
| 82 | meshes_dir_name = meshes_dir + scenario_name |
---|
[3940] | 83 | |
---|
[4186] | 84 | polygons_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'polygons'+sep+'2007polys'+sep |
---|
[4147] | 85 | tide_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'tide_data'+sep |
---|
[3940] | 86 | |
---|
[4193] | 87 | boundaries_source = '' |
---|
[4196] | 88 | boundaries_name = 'o' |
---|
[4282] | 89 | boundaries_name1 = 'o_new1' |
---|
| 90 | boundaries_name2 = 'o_test' |
---|
[4246] | 91 | |
---|
[4147] | 92 | #boundaries locations |
---|
[4282] | 93 | #boundaries_in_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep |
---|
| 94 | boundaries_in_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep+'1_10000'+sep |
---|
[4193] | 95 | boundaries_in_dir_name = boundaries_in_dir + boundaries_name |
---|
[4291] | 96 | boundaries_in_dir2 = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep+'ungridded'+sep |
---|
| 97 | boundaries_in_dir_name2 = boundaries_in_dir2 + boundaries_name |
---|
[4147] | 98 | boundaries_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep |
---|
[4193] | 99 | boundaries_dir_name = boundaries_dir + boundaries_name |
---|
[4357] | 100 | boundaries_dir_namea = boundaries_dir + boundaries_name+'_5000_35000' |
---|
[4246] | 101 | boundaries_dir_name1 = boundaries_dir + boundaries_name1 |
---|
[4282] | 102 | boundaries_dir_name2 = boundaries_dir + boundaries_name2 |
---|
| 103 | boundaries_dir_name3 = boundaries_dir + boundaries_name+'_test_8500_12000' |
---|
| 104 | boundaries_dir_name4 = boundaries_dir + boundaries_name+'_8500_12000_no_zone' |
---|
[4308] | 105 | boundaries_dir_name5 = boundaries_dir + '20061026_173920_build'+sep+'dampier' |
---|
| 106 | boundaries_dir_name6 = boundaries_dir + 'SU-AU' |
---|
[4282] | 107 | |
---|
[4147] | 108 | #boundaries_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+build_time+sep |
---|
| 109 | #boundaries_time_dir_name = boundaries_time_dir + boundaries_name #Used by post processing |
---|
[3627] | 110 | |
---|
[4147] | 111 | #output locations |
---|
| 112 | output_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep |
---|
| 113 | output_build_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+build_time+sep |
---|
| 114 | output_run_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+run_time+sep |
---|
[3851] | 115 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
[3828] | 116 | |
---|
[4147] | 117 | #gauges |
---|
[4222] | 118 | gauge_name = 'dampier_gauges_up2.csv' #'dampier.csv' |
---|
[4581] | 119 | |
---|
[4311] | 120 | gauge_name_simple = 'dampier_gauges_simple.csv' |
---|
[4282] | 121 | gauge_name_test = 'dampier_gauges_up_test.csv' #'dampier.csv' |
---|
[4147] | 122 | gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep |
---|
| 123 | gauges_dir_name = gauges_dir + gauge_name |
---|
[4311] | 124 | gauges_dir_name_simple = gauges_dir + gauge_name_simple |
---|
[4282] | 125 | gauges_dir_name_test = gauges_dir + gauge_name_test |
---|
[4581] | 126 | beach_gauges = gauges_dir + 'beach_gauges.csv' |
---|
[3851] | 127 | |
---|
[4423] | 128 | community_filename = gauges_dir + 'CHINS_v2.csv' |
---|
| 129 | community_KD = gauges_dir + 'community_KD.csv' |
---|
[4282] | 130 | |
---|
[4504] | 131 | buildings_filename = gauges_dir + 'Dampier_res_Project.csv' |
---|
| 132 | buildings_filename_out = 'Dampier_res_Project_modified.csv' |
---|
[4147] | 133 | ############################### |
---|
| 134 | # Domain definitions |
---|
| 135 | ############################### |
---|
[3627] | 136 | |
---|
| 137 | refzone = 50 |
---|
[4193] | 138 | south_boundary = degminsec2decimal_degrees(-20,58,0) |
---|
[4282] | 139 | #north_boundary = degminsec2decimal_degrees(-20,13,0) |
---|
| 140 | north_boundary = degminsec2decimal_degrees(-19,30,0) |
---|
[4193] | 141 | west_boundary = degminsec2decimal_degrees(116,15,0) |
---|
| 142 | east_boundary = degminsec2decimal_degrees(117,11,0) |
---|
[4186] | 143 | ## |
---|
| 144 | ##p0 = [south, degminsec2decimal_degrees(116,32,0)] |
---|
| 145 | ##p1 = [south, west] |
---|
| 146 | ##p2 = [degminsec2decimal_degrees(-20,23,0), west] |
---|
| 147 | ##p3 = [north, degminsec2decimal_degrees(116,45,0)] |
---|
| 148 | ##p4 = [north, degminsec2decimal_degrees(117,0,0)] |
---|
| 149 | ##p5 = [p2[0], degminsec2decimal_degrees(117,8,0)] |
---|
| 150 | ##p6 = [degminsec2decimal_degrees(-20,30,0), east] |
---|
| 151 | ##p7 = [degminsec2decimal_degrees(-20,38,0), east] |
---|
| 152 | ##p8 = [south, east] |
---|
| 153 | ## |
---|
| 154 | ##poly_all, zone = convert_from_latlon_to_utm([p0, p1, p2, p3, p4, p5, p6, p7, p8]) |
---|
| 155 | ##refzone = zone |
---|
| 156 | poly_all = read_polygon(polygons_dir+'extent.csv') |
---|
[4147] | 157 | print 'Area of bounding polygon', polygon_area(poly_all)/1000000.0 |
---|
[3627] | 158 | |
---|
[4430] | 159 | res_factor = 2 |
---|
[4401] | 160 | res_poly_all = 150000*res_factor |
---|
[4430] | 161 | #res_poly_all = 150000 |
---|
[3744] | 162 | |
---|
[4430] | 163 | poly_pipeline = read_polygon(polygons_dir+'pipeline2.csv') |
---|
| 164 | res_pipeline = 2000 |
---|
| 165 | |
---|
[4147] | 166 | ############################### |
---|
| 167 | # Interior region definitions |
---|
| 168 | ############################### |
---|
| 169 | |
---|
[4186] | 170 | poly_region = read_polygon(polygons_dir+'region.csv') |
---|
[4401] | 171 | res_region = 50000*res_factor |
---|
[4186] | 172 | |
---|
| 173 | poly_dampier = read_polygon(polygons_dir+'dampier_town.csv') |
---|
[4401] | 174 | res_dampier = 500*res_factor |
---|
[4147] | 175 | |
---|
[4186] | 176 | poly_karratha = read_polygon(polygons_dir+'karrathav2.csv') |
---|
[4401] | 177 | res_karratha = 15000*res_factor |
---|
[4147] | 178 | |
---|
[4186] | 179 | poly_karratha_town = read_polygon(polygons_dir+'karratha_townv2.csv') |
---|
[4401] | 180 | res_karratha_town = 500*res_factor |
---|
[4186] | 181 | |
---|
[4193] | 182 | poly_facility = read_polygon(polygons_dir+'facility.csv') |
---|
[4401] | 183 | res_facility = 1000*res_factor |
---|
[4193] | 184 | |
---|
[4186] | 185 | poly_delambre = read_polygon(polygons_dir+'delambre.csv') |
---|
[4401] | 186 | res_delambre = 1000*res_factor |
---|
[4147] | 187 | |
---|
[4186] | 188 | poly_coast = read_polygon(polygons_dir+'coastpoly.csv') |
---|
[4401] | 189 | res_coast = 5000*res_factor |
---|
[4147] | 190 | |
---|
[4186] | 191 | poly_NWislands = read_polygon(polygons_dir+'nw_islands_area.csv') |
---|
[4401] | 192 | res_NWislands = 50000*res_factor |
---|
[4147] | 193 | |
---|
[4186] | 194 | poly_island0 = read_polygon(polygons_dir+'island0.csv') |
---|
| 195 | res_island0 = res_poly_all |
---|
[4147] | 196 | |
---|
[4186] | 197 | poly_island1 = read_polygon(polygons_dir+'island1.csv') |
---|
| 198 | res_island0 = res_poly_all |
---|
| 199 | |
---|
| 200 | poly_island2 = read_polygon(polygons_dir+'island2.csv') |
---|
| 201 | res_island0 = res_poly_all |
---|
| 202 | |
---|
| 203 | poly_island3 = read_polygon(polygons_dir+'island3.csv') |
---|
| 204 | res_island0 = res_poly_all |
---|
| 205 | |
---|
[4401] | 206 | res_islands = 5000*res_factor |
---|
[4186] | 207 | |
---|
| 208 | poly_ref_nw4 = read_polygon(polygons_dir+'ref_nw4.csv') |
---|
| 209 | res_ref_nw4 = res_islands |
---|
| 210 | |
---|
| 211 | poly_island4 = read_polygon(polygons_dir+'island4.csv') |
---|
| 212 | res_island0 = res_poly_all |
---|
| 213 | |
---|
| 214 | poly_ref_nw5 = read_polygon(polygons_dir+'ref_nw5.csv') |
---|
| 215 | res_ref_nw5 = res_islands |
---|
| 216 | |
---|
| 217 | poly_island5 = read_polygon(polygons_dir+'island5.csv') |
---|
| 218 | res_island0 = res_poly_all |
---|
| 219 | |
---|
| 220 | poly_ref_nw6 = read_polygon(polygons_dir+'ref_nw6.csv') |
---|
| 221 | res_ref_nw6 = res_islands |
---|
| 222 | |
---|
| 223 | poly_island6 = read_polygon(polygons_dir+'island6.csv') |
---|
| 224 | res_island0 = res_poly_all |
---|
| 225 | |
---|
| 226 | poly_ref_nw7 = read_polygon(polygons_dir+'ref_nw7.csv') |
---|
| 227 | res_ref_nw7 = res_islands |
---|
| 228 | |
---|
| 229 | poly_island7 = read_polygon(polygons_dir+'island7.csv') |
---|
| 230 | res_island0 = res_poly_all |
---|
| 231 | |
---|
| 232 | poly_ref_nw8 = read_polygon(polygons_dir+'ref_nw8.csv') |
---|
| 233 | res_ref_nw8 = res_islands |
---|
| 234 | |
---|
| 235 | poly_island8 = read_polygon(polygons_dir+'island8.csv') |
---|
| 236 | res_island0 = res_poly_all |
---|
| 237 | |
---|
| 238 | |
---|
[4856] | 239 | #plot_polygons([poly_dampier,poly_karratha,poly_karratha_town,poly_delambre, |
---|
[4401] | 240 | # poly_coast,poly_NWislands,poly_island0,poly_island1,poly_island2, |
---|
| 241 | # poly_island3,poly_island4,poly_island5,poly_island6, |
---|
| 242 | # poly_island7,poly_island8,poly_ref_nw4,poly_ref_nw5, |
---|
[4853] | 243 | # poly_ref_nw6,poly_ref_nw7,poly_ref_nw8,poly_all],figname='poly_pic') |
---|
[4186] | 244 | |
---|
| 245 | interior_regions = [[poly_dampier,res_dampier], |
---|
| 246 | [poly_karratha,res_karratha],[poly_karratha_town,res_karratha_town], |
---|
| 247 | [poly_delambre,res_delambre],[poly_coast,res_coast], |
---|
[4193] | 248 | [poly_facility,res_facility], |
---|
[4186] | 249 | #[poly_NWislands,res_NWislands], |
---|
| 250 | [poly_island0,res_island0],[poly_island1,res_island0], |
---|
| 251 | [poly_island2,res_island0],[poly_island3,res_island0], |
---|
| 252 | [poly_island4,res_island0],[poly_island5,res_island0], |
---|
| 253 | [poly_island6,res_island0],[poly_island7,res_island0], |
---|
| 254 | [poly_island8,res_island0],[poly_ref_nw4,res_ref_nw4], |
---|
| 255 | [poly_ref_nw5,res_ref_nw5],[poly_ref_nw6,res_ref_nw6], |
---|
[4430] | 256 | [poly_ref_nw7,res_ref_nw7],[poly_ref_nw8,res_ref_nw8] |
---|
| 257 | # ,[poly_pipeline,res_pipeline] |
---|
| 258 | ] |
---|
[4147] | 259 | |
---|
[4282] | 260 | interior_regions_test = [[poly_dampier,res_dampier], |
---|
| 261 | [poly_karratha,res_karratha],[poly_karratha_town,res_karratha_town]] |
---|
| 262 | |
---|
[4373] | 263 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
[4282] | 264 | |
---|
| 265 | print 'min number triangles', trigs_min |
---|
| 266 | |
---|
[4147] | 267 | ################################################################### |
---|
| 268 | # Clipping regions for export to asc and regions for clipping data |
---|
| 269 | ################################################################### |
---|
| 270 | |
---|
[4401] | 271 | poly_mainland = read_polygon(polygons_dir+'mainland_only.csv') |
---|
[4164] | 272 | |
---|
[4423] | 273 | # exporting asc grid - Dampier gas facility |
---|
[4147] | 274 | e_min_area = 474000 |
---|
| 275 | e_max_area = 480000 |
---|
| 276 | n_min_area = 7719000 |
---|
| 277 | n_max_area = 7725000 |
---|
| 278 | |
---|
[4423] | 279 | # residential Dampier |
---|
| 280 | e_min_area_d = 468450 |
---|
| 281 | e_max_area_d = 470820 |
---|
| 282 | n_min_area_d = 7714050 |
---|
| 283 | n_max_area_d = 7716625 |
---|
| 284 | |
---|
| 285 | # residential Karratha |
---|
| 286 | e_min_area_k = 474690 |
---|
| 287 | e_max_area_k = 489900 |
---|
| 288 | n_min_area_k = 7704760 |
---|
| 289 | n_max_area_k = 7712600 |
---|