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