[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() |
---|
[4077] | 18 | user = get_user_name() |
---|
[5111] | 19 | host = get_host_name() |
---|
[3908] | 20 | |
---|
| 21 | # INUNDATIONHOME is the inundation directory, not the data directory. |
---|
| 22 | |
---|
[4080] | 23 | #time stuff |
---|
| 24 | time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir |
---|
| 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' |
---|
| 28 | print 'gtime: ', gtime |
---|
| 29 | |
---|
[3908] | 30 | #Making assumptions about the location of scenario data |
---|
| 31 | state = 'western_australia' |
---|
[4077] | 32 | scenario_name = 'perth' |
---|
[5111] | 33 | scenario = 'perth_tsunami_scenario' |
---|
[3908] | 34 | |
---|
[5111] | 35 | tide = 0.6 |
---|
| 36 | |
---|
| 37 | alpha = 0.1 |
---|
| 38 | friction=0.01 |
---|
| 39 | starttime=10000 |
---|
| 40 | midtime=21600 |
---|
| 41 | finaltime=10000 |
---|
| 42 | export_cellsize=50 |
---|
[5152] | 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' |
---|
| 69 | island_name2 = 'carnac_island_dted' |
---|
[4080] | 70 | island_name3 = 'penguin_dted' |
---|
[3908] | 71 | |
---|
[4147] | 72 | # AHO + DPI data + colin French coastline |
---|
[5357] | 73 | coast_name = 'coastline' |
---|
[4077] | 74 | offshore_name = 'perth_bathymetry' |
---|
[3908] | 75 | |
---|
[5357] | 76 | |
---|
[4077] | 77 | #final topo name |
---|
| 78 | combined_name ='perth_combined_elevation' |
---|
[4091] | 79 | combined_smaller_name = 'perth_combined_elevation_smaller' |
---|
[3908] | 80 | |
---|
[5111] | 81 | anuga_dir = home+state+sep+scenario+sep+'anuga'+sep |
---|
[4091] | 82 | |
---|
[5360] | 83 | topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep |
---|
[5111] | 84 | topographies_dir = anuga_dir+'topographies'+sep |
---|
[5122] | 85 | #topographies_time_dir = topographies_dir+build_time+sep |
---|
[3908] | 86 | |
---|
[4147] | 87 | # input topo file location |
---|
[4080] | 88 | onshore_in_dir_name = topographies_in_dir + onshore_name |
---|
| 89 | island_in_dir_name = topographies_in_dir + island_name |
---|
| 90 | island_in_dir_name1 = topographies_in_dir + island_name1 |
---|
| 91 | island_in_dir_name2 = topographies_in_dir + island_name2 |
---|
| 92 | island_in_dir_name3 = topographies_in_dir + island_name3 |
---|
| 93 | |
---|
| 94 | coast_in_dir_name = topographies_in_dir + coast_name |
---|
| 95 | offshore_in_dir_name = topographies_in_dir + offshore_name |
---|
| 96 | |
---|
[5357] | 97 | |
---|
[4077] | 98 | onshore_dir_name = topographies_dir + onshore_name |
---|
| 99 | island_dir_name = topographies_dir + island_name |
---|
| 100 | island_dir_name1 = topographies_dir + island_name1 |
---|
| 101 | island_dir_name2 = topographies_dir + island_name2 |
---|
[4080] | 102 | island_dir_name3 = topographies_dir + island_name3 |
---|
[3908] | 103 | |
---|
[4077] | 104 | coast_dir_name = topographies_dir + coast_name |
---|
| 105 | offshore_dir_name = topographies_dir + offshore_name |
---|
| 106 | |
---|
| 107 | #final topo files |
---|
| 108 | combined_dir_name = topographies_dir + combined_name |
---|
[5122] | 109 | #combined_time_dir_name = topographies_time_dir + combined_name |
---|
[4091] | 110 | combined_smaller_name_dir = topographies_dir + combined_smaller_name |
---|
[4080] | 111 | #combined_time_dir_final_name = topographies_time_dir + combined_final_name |
---|
[4077] | 112 | |
---|
[5111] | 113 | meshes_dir = anuga_dir+'meshes'+sep |
---|
| 114 | meshes_dir_name = meshes_dir + scenario_name |
---|
[4077] | 115 | |
---|
[5111] | 116 | polygons_dir = anuga_dir+'polygons'+sep |
---|
| 117 | tide_dir = anuga_dir+'tide_data'+sep |
---|
[3908] | 118 | |
---|
| 119 | |
---|
[5111] | 120 | #boundaries_source = '1' |
---|
| 121 | |
---|
| 122 | if source=='exmouth': |
---|
[5386] | 123 | boundaries_name = 'perth_3103_28052008' #exmouth gun |
---|
[5111] | 124 | boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'exmouth'+sep+'1_10000'+sep |
---|
| 125 | |
---|
| 126 | if source=='test': |
---|
| 127 | boundaries_name = 'other' #exmouth gun |
---|
| 128 | boundaries_in_dir = anuga_dir+'boundaries'+sep |
---|
| 129 | |
---|
| 130 | |
---|
[4077] | 131 | #boundaries locations |
---|
[5387] | 132 | boundaries_in_dir_name = boundaries_in_dir + boundaries_name |
---|
[5111] | 133 | boundaries_dir = anuga_dir+'boundaries'+sep |
---|
[4080] | 134 | boundaries_dir_name = boundaries_dir + scenario_name |
---|
[5111] | 135 | #boundaries_time_dir = anuga_dir+'boundaries'+sep+build_time+sep |
---|
[4077] | 136 | #boundaries_time_dir_name = boundaries_time_dir + boundaries_name #Used by post processing |
---|
[3908] | 137 | |
---|
[4077] | 138 | #output locations |
---|
[5111] | 139 | output_dir = anuga_dir+'outputs'+sep |
---|
[5122] | 140 | output_build_time_dir = anuga_dir+'outputs'+sep+build_time+dir_comment+sep |
---|
| 141 | output_run_time_dir = anuga_dir+'outputs'+sep+run_time+dir_comment+sep |
---|
[4077] | 142 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
| 143 | |
---|
| 144 | #gauges |
---|
| 145 | gauge_name = 'perth.csv' |
---|
[5111] | 146 | gauges_dir = anuga_dir+'gauges'+sep |
---|
[4077] | 147 | gauges_dir_name = gauges_dir + gauge_name |
---|
| 148 | |
---|
[5381] | 149 | buildings_filename = gauges_dir + 'Perth_resA.csv' |
---|
[4477] | 150 | buildings_filename_out = 'Perth_res_Project_modified.csv' |
---|
[4077] | 151 | |
---|
[3908] | 152 | ############################### |
---|
| 153 | # Domain definitions |
---|
| 154 | ############################### |
---|
[4856] | 155 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon |
---|
[3908] | 156 | |
---|
[5357] | 157 | poly_all = read_polygon(polygons_dir+'bounding_area.csv') |
---|
[5111] | 158 | res_poly_all = 100000*res_factor |
---|
[3908] | 159 | |
---|
[5111] | 160 | #refzone = 50 |
---|
[3908] | 161 | |
---|
[4091] | 162 | ############################### |
---|
| 163 | # Interior region definitions |
---|
| 164 | ############################### |
---|
[4077] | 165 | |
---|
[5357] | 166 | #Polygon designed by 20m contours, or 3km from the coastline |
---|
[5360] | 167 | poly_internal_20_3 = read_polygon(polygons_dir+'internal_h20mORd3km.csv') |
---|
[5357] | 168 | res_internal_20_3 = 20000*res_factor |
---|
[4077] | 169 | |
---|
[5357] | 170 | #Polygon designed to incorporate Garden Island and sand bank infront of Rockingham |
---|
| 171 | poly_garden_rockingham = read_polygon(polygons_dir+'garden_rockingham.csv') |
---|
| 172 | res_garden_rockingham = 1000*res_factor |
---|
| 173 | |
---|
| 174 | #Polygon designed to incorporate coastline of rottnest |
---|
[5360] | 175 | poly_rottnest_ex = read_polygon(polygons_dir+'rottnest_external.csv') |
---|
| 176 | res_rottnest_ex = 1000*res_factor |
---|
[5357] | 177 | |
---|
[5360] | 178 | #Polygon designed to cut out the rottnest island land. |
---|
| 179 | poly_rottnest_in = read_polygon(polygons_dir+'rottnest_internal.csv') |
---|
| 180 | res_rottnest_in = 20000*res_factor |
---|
| 181 | |
---|
[5357] | 182 | #Polygon designed to incorporate perth and Fremantle CBD |
---|
| 183 | poly_cbd = read_polygon(polygons_dir+'CBD_coastal.csv') |
---|
[5111] | 184 | res_cbd = 500*res_factor |
---|
[4077] | 185 | |
---|
[5357] | 186 | #Polygon designed to incorporate rockingham and penguin island |
---|
| 187 | poly_penguin = read_polygon(polygons_dir+'rockingham_penguin.csv') |
---|
[5111] | 188 | res_penguin = 500*res_factor |
---|
| 189 | |
---|
[5357] | 190 | poly_geordie_bay = read_polygon(polygons_dir+'Geordie_Bay.csv') |
---|
[5111] | 191 | res_geordie_bay = 500*res_factor |
---|
| 192 | |
---|
[5357] | 193 | poly_sorrento_gauge = read_polygon(polygons_dir+'Sorrento_gauge.csv') |
---|
[5111] | 194 | res_sorrento_gauge = 500*res_factor |
---|
[4080] | 195 | #assert zone == refzone |
---|
[4077] | 196 | |
---|
[5357] | 197 | interior_regions = [[poly_internal_20_3,res_internal_20_3],[poly_cbd,res_cbd] |
---|
| 198 | ,[poly_garden_rockingham,res_garden_rockingham] |
---|
[5152] | 199 | ,[poly_penguin,res_penguin],[poly_geordie_bay,res_geordie_bay] |
---|
[5360] | 200 | ,[poly_sorrento_gauge,res_sorrento_gauge],[poly_rottnest_in, res_rottnest_in] |
---|
| 201 | ,[poly_rottnest_ex, res_rottnest_ex]] |
---|
[4077] | 202 | |
---|
[5386] | 203 | boundary_tags={'back': [0,1,2], 'side': [3,7],'ocean': [4, 5, 6]} |
---|
[5111] | 204 | |
---|
[4133] | 205 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
| 206 | |
---|
[4091] | 207 | print 'min number triangles', trigs_min |
---|
[4081] | 208 | |
---|
[5386] | 209 | poly_mainland = read_polygon(polygons_dir+'Initial_Condition.csv') |
---|
| 210 | |
---|
[3908] | 211 | ################################################################### |
---|
| 212 | # Clipping regions for export to asc and regions for clipping data |
---|
| 213 | ################################################################### |
---|
[4091] | 214 | |
---|
[3908] | 215 | # exporting asc grid |
---|
[4988] | 216 | eastingmin = 379000 |
---|
| 217 | eastingmax = 385000 |
---|
| 218 | northingmin = 6450700 |
---|
| 219 | northingmax = 6459800 |
---|
[3908] | 220 | |
---|
| 221 | |
---|
| 222 | |
---|