[3908] | 1 | # -*- coding: cp1252 -*- |
---|
| 2 | """Common filenames and locations for topographic data, meshes and outputs. |
---|
| 3 | """ |
---|
| 4 | |
---|
| 5 | from os import sep, environ, getenv, getcwd |
---|
| 6 | from os.path import expanduser |
---|
| 7 | import sys |
---|
| 8 | from time import localtime, strftime, gmtime |
---|
[4856] | 9 | from anuga.utilities.polygon import read_polygon, plot_polygons, is_inside_polygon, number_mesh_triangles |
---|
[3908] | 10 | #from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees, convert_points_from_latlon_to_utm |
---|
[5111] | 11 | from anuga.utilities.system_tools import get_user_name, get_host_name |
---|
[3908] | 12 | |
---|
[4077] | 13 | # file and system info |
---|
| 14 | #--------------------------------- |
---|
[5111] | 15 | #codename = 'project.py' |
---|
[3908] | 16 | |
---|
[5111] | 17 | home = getenv('INUNDATIONHOME') + sep +'data'+sep #Sandpit's parent diruser = get_user_name() |
---|
[5467] | 18 | muxhome = getenv('MUXHOME') |
---|
[4077] | 19 | user = get_user_name() |
---|
[5111] | 20 | host = get_host_name() |
---|
[3908] | 21 | |
---|
| 22 | # INUNDATIONHOME is the inundation directory, not the data directory. |
---|
| 23 | |
---|
[4080] | 24 | #time stuff |
---|
| 25 | time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir |
---|
| 26 | gtime = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir |
---|
| 27 | build_time = time+'_build' |
---|
| 28 | run_time = time+'_run' |
---|
| 29 | print 'gtime: ', gtime |
---|
| 30 | |
---|
[3908] | 31 | #Making assumptions about the location of scenario data |
---|
| 32 | state = 'western_australia' |
---|
[4077] | 33 | scenario_name = 'perth' |
---|
[5111] | 34 | scenario = 'perth_tsunami_scenario' |
---|
[3908] | 35 | |
---|
[5523] | 36 | tide = 0 |
---|
[5111] | 37 | |
---|
| 38 | alpha = 0.1 |
---|
| 39 | friction=0.01 |
---|
[5415] | 40 | starttime=0 |
---|
[5499] | 41 | finaltime=100 # change back to 800000 |
---|
[5415] | 42 | export_cellsize=25 |
---|
[5432] | 43 | setup='final' |
---|
[5386] | 44 | source='exmouth' |
---|
[5111] | 45 | |
---|
| 46 | if setup =='trial': |
---|
| 47 | print'trial' |
---|
| 48 | res_factor=10 |
---|
| 49 | time_thinning=48 |
---|
| 50 | yieldstep=240 |
---|
| 51 | if setup =='basic': |
---|
| 52 | print'basic' |
---|
| 53 | res_factor=4 |
---|
| 54 | time_thinning=12 |
---|
| 55 | yieldstep=120 |
---|
| 56 | if setup =='final': |
---|
| 57 | print'final' |
---|
| 58 | res_factor=1 |
---|
| 59 | time_thinning=4 |
---|
| 60 | yieldstep=60 |
---|
| 61 | |
---|
| 62 | dir_comment='_'+setup+'_'+str(tide)+'_'+str(source)+'_'+str(user) |
---|
| 63 | |
---|
[3908] | 64 | # onshore data provided by WA DLI |
---|
[4077] | 65 | onshore_name = 'perth_dli_ext' # original |
---|
| 66 | #island |
---|
| 67 | island_name = 'rott_dli_ext' # original |
---|
| 68 | island_name1 = 'gard_dli_ext' |
---|
[5491] | 69 | island_name2 = 'carnac_island_dli_ext' |
---|
[5489] | 70 | island_name3 = 'penguin_dli_ext' |
---|
[3908] | 71 | |
---|
[4147] | 72 | # AHO + DPI data + colin French coastline |
---|
[5523] | 73 | coast_name = 'coastline_perthP' |
---|
[5499] | 74 | offshore_name = 'Perth_Clip' |
---|
[5523] | 75 | offshore_name1 = 'Perth_Chart' |
---|
| 76 | offshore_name2 = 'Fremantle_north' |
---|
[3908] | 77 | |
---|
[5357] | 78 | |
---|
[5499] | 79 | |
---|
[5523] | 80 | |
---|
[4077] | 81 | #final topo name |
---|
| 82 | combined_name ='perth_combined_elevation' |
---|
[4091] | 83 | combined_smaller_name = 'perth_combined_elevation_smaller' |
---|
[3908] | 84 | |
---|
[5111] | 85 | anuga_dir = home+state+sep+scenario+sep+'anuga'+sep |
---|
[4091] | 86 | |
---|
[5360] | 87 | topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep |
---|
[5111] | 88 | topographies_dir = anuga_dir+'topographies'+sep |
---|
[5122] | 89 | #topographies_time_dir = topographies_dir+build_time+sep |
---|
[3908] | 90 | |
---|
[4147] | 91 | # input topo file location |
---|
[4080] | 92 | onshore_in_dir_name = topographies_in_dir + onshore_name |
---|
| 93 | island_in_dir_name = topographies_in_dir + island_name |
---|
| 94 | island_in_dir_name1 = topographies_in_dir + island_name1 |
---|
| 95 | island_in_dir_name2 = topographies_in_dir + island_name2 |
---|
| 96 | island_in_dir_name3 = topographies_in_dir + island_name3 |
---|
| 97 | |
---|
| 98 | coast_in_dir_name = topographies_in_dir + coast_name |
---|
| 99 | offshore_in_dir_name = topographies_in_dir + offshore_name |
---|
[5523] | 100 | offshore_in_dir_name1 = topographies_in_dir + offshore_name1 |
---|
| 101 | offshore_in_dir_name2 = topographies_in_dir + offshore_name2 |
---|
[4080] | 102 | |
---|
[4077] | 103 | onshore_dir_name = topographies_dir + onshore_name |
---|
| 104 | island_dir_name = topographies_dir + island_name |
---|
| 105 | island_dir_name1 = topographies_dir + island_name1 |
---|
| 106 | island_dir_name2 = topographies_dir + island_name2 |
---|
[4080] | 107 | island_dir_name3 = topographies_dir + island_name3 |
---|
[3908] | 108 | |
---|
[4077] | 109 | coast_dir_name = topographies_dir + coast_name |
---|
| 110 | offshore_dir_name = topographies_dir + offshore_name |
---|
[5523] | 111 | offshore_dir_name1 = topographies_dir + offshore_name1 |
---|
| 112 | offshore_dir_name2 = topographies_dir + offshore_name2 |
---|
[4077] | 113 | |
---|
| 114 | #final topo files |
---|
| 115 | combined_dir_name = topographies_dir + combined_name |
---|
[5122] | 116 | #combined_time_dir_name = topographies_time_dir + combined_name |
---|
[4091] | 117 | combined_smaller_name_dir = topographies_dir + combined_smaller_name |
---|
[4080] | 118 | #combined_time_dir_final_name = topographies_time_dir + combined_final_name |
---|
[4077] | 119 | |
---|
[5111] | 120 | meshes_dir = anuga_dir+'meshes'+sep |
---|
| 121 | meshes_dir_name = meshes_dir + scenario_name |
---|
[4077] | 122 | |
---|
[5111] | 123 | polygons_dir = anuga_dir+'polygons'+sep |
---|
| 124 | tide_dir = anuga_dir+'tide_data'+sep |
---|
[3908] | 125 | |
---|
| 126 | |
---|
[5111] | 127 | #boundaries_source = '1' |
---|
| 128 | |
---|
| 129 | if source=='exmouth': |
---|
[5386] | 130 | boundaries_name = 'perth_3103_28052008' #exmouth gun |
---|
[5111] | 131 | boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'exmouth'+sep+'1_10000'+sep |
---|
| 132 | |
---|
| 133 | if source=='test': |
---|
| 134 | boundaries_name = 'other' #exmouth gun |
---|
| 135 | boundaries_in_dir = anuga_dir+'boundaries'+sep |
---|
| 136 | |
---|
| 137 | |
---|
[4077] | 138 | #boundaries locations |
---|
[5387] | 139 | boundaries_in_dir_name = boundaries_in_dir + boundaries_name |
---|
[5111] | 140 | boundaries_dir = anuga_dir+'boundaries'+sep |
---|
[5467] | 141 | boundaries_dir_name = boundaries_dir + scenario_name # what it creates??? |
---|
| 142 | boundaries_dir_mux = muxhome |
---|
[5111] | 143 | #boundaries_time_dir = anuga_dir+'boundaries'+sep+build_time+sep |
---|
[4077] | 144 | #boundaries_time_dir_name = boundaries_time_dir + boundaries_name #Used by post processing |
---|
[3908] | 145 | |
---|
[4077] | 146 | #output locations |
---|
[5111] | 147 | output_dir = anuga_dir+'outputs'+sep |
---|
[5122] | 148 | output_build_time_dir = anuga_dir+'outputs'+sep+build_time+dir_comment+sep |
---|
| 149 | output_run_time_dir = anuga_dir+'outputs'+sep+run_time+dir_comment+sep |
---|
[4077] | 150 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
| 151 | |
---|
| 152 | #gauges |
---|
| 153 | gauge_name = 'perth.csv' |
---|
[5415] | 154 | |
---|
| 155 | gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep |
---|
| 156 | beach_gauges = gauges_dir + 'beach_gauges.csv' |
---|
[4077] | 157 | gauges_dir_name = gauges_dir + gauge_name |
---|
| 158 | |
---|
[5381] | 159 | buildings_filename = gauges_dir + 'Perth_resA.csv' |
---|
[4477] | 160 | buildings_filename_out = 'Perth_res_Project_modified.csv' |
---|
[4077] | 161 | |
---|
[3908] | 162 | ############################### |
---|
| 163 | # Domain definitions |
---|
| 164 | ############################### |
---|
[4856] | 165 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon |
---|
[3908] | 166 | |
---|
[5489] | 167 | poly_all = read_polygon(polygons_dir+'poly_all.csv') |
---|
[5111] | 168 | res_poly_all = 100000*res_factor |
---|
[3908] | 169 | |
---|
[5111] | 170 | #refzone = 50 |
---|
[3908] | 171 | |
---|
[4091] | 172 | ############################### |
---|
| 173 | # Interior region definitions |
---|
| 174 | ############################### |
---|
[4077] | 175 | |
---|
[5357] | 176 | #Polygon designed by 20m contours, or 3km from the coastline |
---|
[5360] | 177 | poly_internal_20_3 = read_polygon(polygons_dir+'internal_h20mORd3km.csv') |
---|
[5432] | 178 | res_internal_20_3 = 25000*res_factor |
---|
[4077] | 179 | |
---|
[5489] | 180 | #Polygon designed to cut out the rottnest island land. |
---|
| 181 | poly_rottnest_in = read_polygon(polygons_dir+'rottnest_internal.csv') |
---|
[5523] | 182 | res_rottnest_in = 100000*res_factor |
---|
[5489] | 183 | |
---|
[5357] | 184 | #Polygon designed to incorporate Garden Island and sand bank infront of Rockingham |
---|
| 185 | poly_garden_rockingham = read_polygon(polygons_dir+'garden_rockingham.csv') |
---|
[5523] | 186 | res_garden_rockingham = 1000*res_factor |
---|
[5357] | 187 | |
---|
| 188 | #Polygon designed to incorporate coastline of rottnest |
---|
[5360] | 189 | poly_rottnest_ex = read_polygon(polygons_dir+'rottnest_external.csv') |
---|
| 190 | res_rottnest_ex = 1000*res_factor |
---|
[5357] | 191 | |
---|
| 192 | #Polygon designed to incorporate perth and Fremantle CBD |
---|
| 193 | poly_cbd = read_polygon(polygons_dir+'CBD_coastal.csv') |
---|
[5111] | 194 | res_cbd = 500*res_factor |
---|
[4077] | 195 | |
---|
[5357] | 196 | #Polygon designed to incorporate rockingham and penguin island |
---|
[5489] | 197 | poly_rockingham = read_polygon(polygons_dir+'rockingham_penguin.csv') |
---|
| 198 | res_rockingham = 500*res_factor |
---|
[5111] | 199 | |
---|
[5489] | 200 | #Polygon designed to incorporate bottom of Garden Island for image verification |
---|
| 201 | poly_garden = read_polygon(polygons_dir+'garden.csv') |
---|
| 202 | res_garden = 500*res_factor |
---|
| 203 | |
---|
| 204 | poly_geordie_bay = read_polygon(polygons_dir+'geordie_bay.csv') |
---|
[5111] | 205 | res_geordie_bay = 500*res_factor |
---|
| 206 | |
---|
[5489] | 207 | poly_sorrento_gauge = read_polygon(polygons_dir+'sorrento_gauge.csv') |
---|
[5111] | 208 | res_sorrento_gauge = 500*res_factor |
---|
[5489] | 209 | |
---|
| 210 | |
---|
[4080] | 211 | #assert zone == refzone |
---|
[4077] | 212 | |
---|
[5357] | 213 | interior_regions = [[poly_internal_20_3,res_internal_20_3],[poly_cbd,res_cbd] |
---|
| 214 | ,[poly_garden_rockingham,res_garden_rockingham] |
---|
[5489] | 215 | ,[poly_rockingham,res_rockingham],[poly_geordie_bay,res_geordie_bay] |
---|
[5360] | 216 | ,[poly_sorrento_gauge,res_sorrento_gauge],[poly_rottnest_in, res_rottnest_in] |
---|
[5489] | 217 | ,[poly_rottnest_ex, res_rottnest_ex], [poly_garden, res_garden]] |
---|
[4077] | 218 | |
---|
[5386] | 219 | boundary_tags={'back': [0,1,2], 'side': [3,7],'ocean': [4, 5, 6]} |
---|
[5111] | 220 | |
---|
[4133] | 221 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
| 222 | |
---|
[4091] | 223 | print 'min number triangles', trigs_min |
---|
[4081] | 224 | |
---|
[5489] | 225 | poly_mainland = read_polygon(polygons_dir+'initial_condition.csv') |
---|
[5386] | 226 | |
---|
[3908] | 227 | ################################################################### |
---|
| 228 | # Clipping regions for export to asc and regions for clipping data |
---|
| 229 | ################################################################### |
---|
[4091] | 230 | |
---|
[3908] | 231 | |
---|
[5408] | 232 | #Geordie Bay extract ascii grid |
---|
[5446] | 233 | xminGeordie = 358000 |
---|
| 234 | xmaxGeordie = 362000 |
---|
| 235 | yminGeordie = 6458500 |
---|
| 236 | ymaxGeordie = 6461000 |
---|
[3908] | 237 | |
---|
[5408] | 238 | #Sorrento extract ascii grid |
---|
[5446] | 239 | xminSorrento = 379000 |
---|
| 240 | xmaxSorrento = 382500 |
---|
| 241 | yminSorrento = 6477000 |
---|
| 242 | ymaxSorrento = 6480000 |
---|
[3908] | 243 | |
---|
[5446] | 244 | #Fremantle extract ascii grid |
---|
| 245 | xminFremantle = 376000 |
---|
| 246 | xmaxFremantle = 388000 |
---|
| 247 | yminFremantle = 6449000 |
---|
| 248 | ymaxFremantle = 6461000 |
---|
[5408] | 249 | |
---|
| 250 | #Rockingham extract ascii grid |
---|
[5446] | 251 | xminRockingham = 373500 |
---|
| 252 | xmaxRockingham = 385500 |
---|
| 253 | yminRockingham = 6424000 |
---|
| 254 | ymaxRockingham = 6433000 |
---|
[5408] | 255 | |
---|