[3627] | 1 | """Common filenames and locations for topographic data, meshes and outputs. |
---|
| 2 | """ |
---|
| 3 | |
---|
[3802] | 4 | import sys |
---|
[3627] | 5 | from os import sep, environ, getenv, getcwd |
---|
| 6 | from os.path import expanduser, basename |
---|
[3802] | 7 | |
---|
[3627] | 8 | from anuga.coordinate_transforms.redfearn import\ |
---|
| 9 | degminsec2decimal_degrees,\ |
---|
[3744] | 10 | convert_from_latlon_to_utm |
---|
[3627] | 11 | |
---|
[3905] | 12 | from time import localtime, strftime, gmtime, ctime |
---|
[3627] | 13 | from anuga.geospatial_data.geospatial_data import * |
---|
[3905] | 14 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area |
---|
[3627] | 15 | |
---|
[3828] | 16 | # file and system info |
---|
| 17 | #--------------------------------- |
---|
[3627] | 18 | codename = 'project.py' |
---|
| 19 | |
---|
| 20 | home = getenv('INUNDATIONHOME') #Sandpit's parent dir |
---|
| 21 | |
---|
| 22 | if sys.platform == 'win32': |
---|
| 23 | user = getenv('USERPROFILE') |
---|
| 24 | else: |
---|
| 25 | user = getenv('LOGNAME') |
---|
| 26 | |
---|
[3669] | 27 | # INUNDATIONHOME is the inundation directory, not the data directory. |
---|
| 28 | home += sep +'data' |
---|
[3828] | 29 | #---------------------------------- |
---|
| 30 | # Location and naming of scenario data |
---|
| 31 | #---------------------------------- |
---|
| 32 | state = 'western_australia' |
---|
| 33 | scenario_name = 'dampier_tsunami' |
---|
| 34 | scenario_datas_name = 'dampier_tsunami_scenario_2006' #name of the directory where the data is stored |
---|
| 35 | #scenario_datas_name = 'karratha_tsunami_scenario_2005' # Tmp location |
---|
[3627] | 36 | |
---|
[3828] | 37 | #mesh_name = 'elevation50m' |
---|
[3905] | 38 | boundaries_name = 'dampier1' |
---|
[3877] | 39 | boundaries_source = 'mag_9_corrected' |
---|
[3905] | 40 | #boundaries_source = 'test' |
---|
[3828] | 41 | |
---|
[3877] | 42 | tide = 2.4 |
---|
[3905] | 43 | #tide = 0.0 |
---|
[3871] | 44 | |
---|
[3828] | 45 | # topography file names |
---|
| 46 | onshore_name = 'dli_no_islands' |
---|
| 47 | coast_name = 'DTED_05_Contour' |
---|
| 48 | islands_name = 'dted_islands' |
---|
| 49 | offshore_name = 'XY100003902' |
---|
| 50 | offshore_name1 = 'XY100003903' |
---|
| 51 | offshore_name2 = 'XY100003951' |
---|
| 52 | offshore_name3 = 'XY100006321' |
---|
| 53 | offshore_name4 = 'XY100011756' |
---|
| 54 | offshore_name5 = 'XY100014243' |
---|
| 55 | offshore_name6 = 'XY100014244' |
---|
| 56 | offshore_name7 = 'XY100021081' |
---|
| 57 | offshore_name8 = 'XY100021082' |
---|
| 58 | offshore_name9 = 'XY100021083' |
---|
| 59 | offshore_name10 = 'XY100021085' |
---|
| 60 | offshore_name11 = 'XY100021086' |
---|
| 61 | offshore_name12 = 'XY100026309' |
---|
| 62 | offshore_name13 = 'XY100026338' |
---|
| 63 | offshore_name14 = 'XYDM83' |
---|
| 64 | |
---|
| 65 | combined_name ='dampier_combined_elevation' |
---|
| 66 | |
---|
| 67 | |
---|
| 68 | |
---|
[3627] | 69 | #Derive subdirectories and filenames |
---|
[3828] | 70 | |
---|
| 71 | meshes_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'meshes'+sep |
---|
| 72 | topographies_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'topographies'+sep |
---|
| 73 | gauges_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'gauges'+sep |
---|
| 74 | polygons_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'polygons'+sep |
---|
[3851] | 75 | boundaries_in_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep+boundaries_source+sep |
---|
[3828] | 76 | #outputdir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'output'+sep |
---|
| 77 | tide_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'tide_data'+sep |
---|
| 78 | |
---|
[3627] | 79 | time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir |
---|
[3885] | 80 | gtime = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir |
---|
[3905] | 81 | #cctime = strftime('%Y%m%d_%H%M%S',ctime()) #gets time for new dir |
---|
[3851] | 82 | build_time = time+'_build' |
---|
| 83 | run_time = time+'_run' |
---|
[3627] | 84 | |
---|
[3885] | 85 | print 'gtime: ', gtime |
---|
[3905] | 86 | #print 'ctime: ', cctime |
---|
[3885] | 87 | |
---|
[3851] | 88 | output_build_time_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'outputs'+sep+build_time+sep |
---|
| 89 | output_run_time_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'outputs'+sep+run_time+sep |
---|
| 90 | topographies_time_dir = topographies_dir+build_time+sep |
---|
| 91 | boundaries_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'boundaries'+sep |
---|
| 92 | boundaries_time_dir = home+sep+state+sep+scenario_datas_name+sep+'anuga'+sep+'boundaries'+sep+build_time+sep |
---|
[3905] | 93 | meshes_time_dir = meshes_dir+build_time+sep |
---|
[3627] | 94 | |
---|
[3851] | 95 | #ideas |
---|
| 96 | #boundaries_time_dir = boundaries_in_dir+'urs'+sep+boundaries_source+sep |
---|
[3828] | 97 | |
---|
| 98 | |
---|
[3627] | 99 | #gauge_filename = gaugedir + 'gauge_location_broome.csv' |
---|
| 100 | |
---|
[3828] | 101 | onshore_dir_name = topographies_dir + onshore_name |
---|
| 102 | coast_dir_name = topographies_dir + coast_name |
---|
| 103 | islands_dir_name = topographies_dir + islands_name |
---|
| 104 | offshore_dir_name = topographies_dir + offshore_name |
---|
| 105 | offshore_dir_name1 = topographies_dir + offshore_name1 |
---|
| 106 | offshore_dir_name2 = topographies_dir + offshore_name2 |
---|
| 107 | offshore_dir_name3 = topographies_dir + offshore_name3 |
---|
| 108 | offshore_dir_name4 = topographies_dir + offshore_name4 |
---|
| 109 | offshore_dir_name5 = topographies_dir + offshore_name5 |
---|
| 110 | offshore_dir_name6 = topographies_dir + offshore_name6 |
---|
| 111 | offshore_dir_name7 = topographies_dir + offshore_name7 |
---|
| 112 | offshore_dir_name8 = topographies_dir + offshore_name8 |
---|
| 113 | offshore_dir_name9 = topographies_dir + offshore_name9 |
---|
| 114 | offshore_dir_name10 = topographies_dir + offshore_name10 |
---|
| 115 | offshore_dir_name11 = topographies_dir + offshore_name11 |
---|
| 116 | offshore_dir_name12 = topographies_dir + offshore_name12 |
---|
| 117 | offshore_dir_name13 = topographies_dir + offshore_name13 |
---|
| 118 | offshore_dir_name14 = topographies_dir + offshore_name14 |
---|
[3627] | 119 | |
---|
[3851] | 120 | #output dir |
---|
[3828] | 121 | combined_dir_name = topographies_dir + combined_name |
---|
[3851] | 122 | combined_time_dir_name = topographies_time_dir + combined_name |
---|
[3627] | 123 | |
---|
[3851] | 124 | meshes_dir_name = meshes_dir + scenario_name |
---|
[3905] | 125 | meshes_time_dir_name = meshes_time_dir + scenario_name |
---|
[3851] | 126 | #output_build_time_dir_name = output_build_time_dir + scenario_name #Used by post processing |
---|
| 127 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
| 128 | boundaries_in_dir_name = boundaries_in_dir + boundaries_name |
---|
| 129 | boundaries_time_dir_name = boundaries_time_dir + boundaries_name #Used by post processing |
---|
[3828] | 130 | |
---|
[3851] | 131 | |
---|
| 132 | |
---|
| 133 | |
---|
[3627] | 134 | # Regions |
---|
| 135 | |
---|
| 136 | refzone = 50 |
---|
| 137 | south = degminsec2decimal_degrees(-20,55,0) |
---|
[3835] | 138 | north = degminsec2decimal_degrees(-20,15,0) |
---|
[3851] | 139 | #north = degminsec2decimal_degrees(-19,15,0) |
---|
[3627] | 140 | west = degminsec2decimal_degrees(116,17,0) |
---|
[3836] | 141 | east = degminsec2decimal_degrees(117,10,0) |
---|
[3627] | 142 | |
---|
[3828] | 143 | #only used to clip boundary condition |
---|
[3905] | 144 | #north_boundary = north + 0.02 |
---|
| 145 | #south_boundary = south - 0.02 |
---|
| 146 | #west_boundary = west - 0.02 |
---|
| 147 | #east_boundary = east + 0.02 |
---|
[3828] | 148 | |
---|
[3905] | 149 | south_boundary = degminsec2decimal_degrees(-21,0,0) |
---|
| 150 | #north_boundary = degminsec2decimal_degrees(-19,00,0) |
---|
| 151 | north_boundary = degminsec2decimal_degrees(-20,10,0) |
---|
| 152 | #west_boundary = degminsec2decimal_degrees(116,0,0) |
---|
| 153 | #east_boundary = degminsec2decimal_degrees(118,00,0) |
---|
| 154 | west_boundary = degminsec2decimal_degrees(116,10,0) |
---|
| 155 | east_boundary = degminsec2decimal_degrees(117,15,0) |
---|
[3828] | 156 | |
---|
[3905] | 157 | |
---|
[3627] | 158 | p0 = [south, degminsec2decimal_degrees(116,32,0)] |
---|
| 159 | p1 = [south, west] |
---|
| 160 | p2 = [degminsec2decimal_degrees(-20,23,0), west] |
---|
| 161 | p3 = [north, degminsec2decimal_degrees(116,45,0)] |
---|
| 162 | p4 = [north, degminsec2decimal_degrees(117,0,0)] |
---|
| 163 | p5 = [p2[0], degminsec2decimal_degrees(117,8,0)] |
---|
| 164 | p6 = [degminsec2decimal_degrees(-20,30,0), east] |
---|
| 165 | p7 = [degminsec2decimal_degrees(-20,38,0), east] |
---|
| 166 | p8 = [south, east] |
---|
| 167 | |
---|
[3716] | 168 | bounding_polygon, zone =\ |
---|
[3905] | 169 | convert_from_latlon_to_utm([p0, p1, p2, p3, p4,p5, p6, p7, p8]) |
---|
| 170 | #bounding_polygon, zone =\ |
---|
| 171 | # convert_from_latlon_to_utm([p1, p2, p3, p4, p5, p6, p7]) |
---|
[3627] | 172 | refzone = zone |
---|
| 173 | |
---|
[3716] | 174 | #Interior regions |
---|
[3744] | 175 | |
---|
| 176 | # CIPMA point of interest |
---|
| 177 | cipma_latitude = -20.588456 |
---|
| 178 | cipma_longitude = 116.771527 |
---|
| 179 | |
---|
| 180 | |
---|
| 181 | k0 = [cipma_latitude-0.02, cipma_longitude-0.02] |
---|
| 182 | k1 = [cipma_latitude-0.02, cipma_longitude+0.02] |
---|
| 183 | k2 = [cipma_latitude+0.02, cipma_longitude+0.02] |
---|
| 184 | k3 = [cipma_latitude+0.02, cipma_longitude-0.02] |
---|
| 185 | |
---|
| 186 | cipma_polygon, zone = convert_from_latlon_to_utm([k0, k1, k2, k3]) |
---|
| 187 | assert zone == refzone |
---|
| 188 | |
---|
[3828] | 189 | e_min_area = 474000 |
---|
| 190 | e_max_area = 480000 |
---|
| 191 | n_min_area = 7719000 |
---|
| 192 | n_max_area = 7725000 |
---|
[3744] | 193 | |
---|
[3905] | 194 | poly_facility = read_polygon(polygons_dir+'facility.csv') |
---|
| 195 | |
---|
| 196 | poly_pipeline = read_polygon(polygons_dir+'pipeline.csv') |
---|
| 197 | |
---|
[3744] | 198 | #Interior regions |
---|
[3627] | 199 | karratha_south = degminsec2decimal_degrees(-20,44,0) |
---|
| 200 | karratha_north = degminsec2decimal_degrees(-20,42,0) |
---|
| 201 | karratha_west = degminsec2decimal_degrees(116,48,0) |
---|
| 202 | karratha_east = degminsec2decimal_degrees(116,53,30) |
---|
| 203 | |
---|
| 204 | k0 = [karratha_south, karratha_west] |
---|
| 205 | k1 = [karratha_south, karratha_east] |
---|
| 206 | k2 = [karratha_north, karratha_east] |
---|
| 207 | k3 = [karratha_north, karratha_west] |
---|
| 208 | |
---|
[3744] | 209 | karratha_polygon, zone = convert_from_latlon_to_utm([k0, k1, k2, k3]) |
---|
[3716] | 210 | assert zone == refzone |
---|
[3627] | 211 | |
---|
| 212 | |
---|
| 213 | #Interior regions |
---|
| 214 | dampier_south = degminsec2decimal_degrees(-20,40,0) |
---|
| 215 | dampier_north = degminsec2decimal_degrees(-20,38,10) |
---|
| 216 | dampier_west = degminsec2decimal_degrees(116,43,0) |
---|
| 217 | dampier_east = degminsec2decimal_degrees(116,45,0) |
---|
| 218 | |
---|
| 219 | d0 = [dampier_south, dampier_west] |
---|
| 220 | d1 = [dampier_south, dampier_east] |
---|
| 221 | d2 = [dampier_north, dampier_east] |
---|
| 222 | d3 = [dampier_north, dampier_west] |
---|
| 223 | |
---|
[3744] | 224 | dampier_polygon, zone = convert_from_latlon_to_utm([d0, d1, d2, d3]) |
---|
[3716] | 225 | assert zone == refzone |
---|
[3627] | 226 | |
---|
| 227 | |
---|
| 228 | #Interior regions |
---|
| 229 | refinery_south = degminsec2decimal_degrees(-20,37,50) |
---|
| 230 | refinery_north = degminsec2decimal_degrees(-20,36,0) |
---|
| 231 | refinery_west = degminsec2decimal_degrees(116,44,0) |
---|
| 232 | refinery_east = degminsec2decimal_degrees(116,46,10) |
---|
| 233 | |
---|
| 234 | d0 = [refinery_south, refinery_west] |
---|
| 235 | d1 = [refinery_south, refinery_east] |
---|
| 236 | d2 = [refinery_north, refinery_east] |
---|
| 237 | d3 = [refinery_north, refinery_west] |
---|
| 238 | |
---|
[3744] | 239 | refinery_polygon, zone = convert_from_latlon_to_utm([d0, d1, d2, d3]) |
---|
[3716] | 240 | assert zone == refzone |
---|
[3627] | 241 | |
---|
| 242 | |
---|
| 243 | #Interior region around 468899, 7715177: |
---|
| 244 | #lat (-20, 39, 44.93753), lon (116, 42, 5.09106) |
---|
| 245 | |
---|
| 246 | point_south = degminsec2decimal_degrees(-20,39,46) |
---|
| 247 | point_north = degminsec2decimal_degrees(-20,39,42) |
---|
| 248 | point_west = degminsec2decimal_degrees(116,42,0) |
---|
| 249 | point_east = degminsec2decimal_degrees(116,42,10) |
---|
| 250 | |
---|
| 251 | d0 = [point_south, point_west] |
---|
| 252 | d1 = [point_south, point_east] |
---|
| 253 | d2 = [point_north, point_east] |
---|
| 254 | d3 = [point_north, point_west] |
---|
| 255 | |
---|
[3744] | 256 | point_polygon, zone = convert_from_latlon_to_utm([d0, d1, d2, d3]) |
---|
[3716] | 257 | assert zone == refzone |
---|
[3627] | 258 | |
---|
| 259 | |
---|
| 260 | #Neils areas around interesting points |
---|
| 261 | neil1_point1 = [degminsec2decimal_degrees(-20,35,34), |
---|
| 262 | degminsec2decimal_degrees(116,45,18)] |
---|
| 263 | neil1_point2 = [degminsec2decimal_degrees(-20,36,15), |
---|
| 264 | degminsec2decimal_degrees(116,46,18)] |
---|
| 265 | neil1_point3 = [degminsec2decimal_degrees(-20,35,9), |
---|
| 266 | degminsec2decimal_degrees(116,47,17)] |
---|
| 267 | neil1_point4 = [degminsec2decimal_degrees(-20,34,26), |
---|
| 268 | degminsec2decimal_degrees(116,46,17)] |
---|
| 269 | |
---|
[3744] | 270 | neil1_polygon, zone = convert_from_latlon_to_utm([neil1_point1, |
---|
| 271 | neil1_point2, |
---|
| 272 | neil1_point3, |
---|
| 273 | neil1_point4]) |
---|
[3716] | 274 | assert zone == refzone |
---|
[3627] | 275 | |
---|
| 276 | |
---|
| 277 | |
---|
[3716] | 278 | |
---|
[3627] | 279 | neil2_point1 = [degminsec2decimal_degrees(-20,39,36), |
---|
| 280 | degminsec2decimal_degrees(116,41,33)] |
---|
| 281 | neil2_point2 = [degminsec2decimal_degrees(-20,40,10), |
---|
| 282 | degminsec2decimal_degrees(116,42,13)] |
---|
| 283 | neil2_point3 = [degminsec2decimal_degrees(-20,38,39), |
---|
| 284 | degminsec2decimal_degrees(116,43,49)] |
---|
| 285 | neil2_point4 = [degminsec2decimal_degrees(-20,38,5), |
---|
| 286 | degminsec2decimal_degrees(116,43,9)] |
---|
| 287 | |
---|
[3744] | 288 | neil2_polygon, zone = convert_from_latlon_to_utm([neil2_point1, |
---|
| 289 | neil2_point2, |
---|
| 290 | neil2_point3, |
---|
| 291 | neil2_point4]) |
---|
[3716] | 292 | assert zone == refzone |
---|
[3627] | 293 | |
---|
| 294 | |
---|
| 295 | |
---|
| 296 | |
---|
[3716] | 297 | |
---|
[3627] | 298 | #Withnell bay |
---|
| 299 | wb_point1 = [degminsec2decimal_degrees(-20,35,34), |
---|
| 300 | degminsec2decimal_degrees(116,45,18)] |
---|
| 301 | wb_point2 = [degminsec2decimal_degrees(-20,36,15), |
---|
| 302 | degminsec2decimal_degrees(116,46,18)] |
---|
| 303 | wb_point3 = [degminsec2decimal_degrees(-20,35,9), |
---|
| 304 | degminsec2decimal_degrees(116,47,17)] |
---|
| 305 | wb_point4 = [degminsec2decimal_degrees(-20,34,26), |
---|
| 306 | degminsec2decimal_degrees(116,46,17)] |
---|
| 307 | |
---|
[3744] | 308 | wb_polygon, zone = convert_from_latlon_to_utm([wb_point1, wb_point2, |
---|
| 309 | wb_point3, wb_point4]) |
---|
[3716] | 310 | assert zone == refzone |
---|
[3627] | 311 | |
---|
| 312 | |
---|
| 313 | |
---|
| 314 | |
---|
[3716] | 315 | |
---|
[3627] | 316 | #Larger Withnell bay |
---|
| 317 | lwb_point1 = [degminsec2decimal_degrees(-20,35,59), |
---|
| 318 | degminsec2decimal_degrees(116,42,00)] |
---|
| 319 | lwb_point2 = [degminsec2decimal_degrees(-20,36,50), |
---|
| 320 | degminsec2decimal_degrees(116,46,50)] |
---|
| 321 | lwb_point3 = [degminsec2decimal_degrees(-20,34,00), |
---|
| 322 | degminsec2decimal_degrees(116,47,39)] |
---|
| 323 | lwb_point4 = [degminsec2decimal_degrees(-20,33,00), |
---|
| 324 | degminsec2decimal_degrees(116,42,50)] |
---|
| 325 | |
---|
[3744] | 326 | lwb_polygon, zone = convert_from_latlon_to_utm([lwb_point1, lwb_point2, |
---|
| 327 | lwb_point3, lwb_point4]) |
---|
[3716] | 328 | |
---|
| 329 | assert zone == refzone |
---|
[3627] | 330 | |
---|
| 331 | |
---|
| 332 | |
---|
[3716] | 333 | |
---|