[3908] | 1 | """Common filenames and locations for topographic data, meshes and outputs. |
---|
[4465] | 2 | Also includes origin for slump scenario. |
---|
[3908] | 3 | """ |
---|
| 4 | |
---|
[4465] | 5 | from os import sep, environ, getenv, getcwd,umask |
---|
| 6 | from os.path import expanduser, basename |
---|
[4856] | 7 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon, number_mesh_triangles |
---|
[3908] | 8 | import sys |
---|
[4465] | 9 | from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees |
---|
[3908] | 10 | from time import localtime, strftime, gmtime |
---|
[4465] | 11 | from anuga.utilities.system_tools import get_user_name, get_host_name |
---|
[3908] | 12 | |
---|
[4509] | 13 | #codename = 'project.py' |
---|
[3908] | 14 | |
---|
[4465] | 15 | home = getenv('INUNDATIONHOME') + sep +'data'+sep #Sandpit's parent dir |
---|
| 16 | user = get_user_name() |
---|
| 17 | host = get_host_name() |
---|
| 18 | #needed when running using mpirun, mpirun doesn't inherit umask from .bashrc |
---|
[4533] | 19 | umask(002) |
---|
[3908] | 20 | |
---|
| 21 | #Making assumptions about the location of scenario data |
---|
| 22 | state = 'western_australia' |
---|
[4465] | 23 | scenario_name = 'exmouth' |
---|
| 24 | scenario = 'exmouth_tsunami_scenario' |
---|
[3908] | 25 | |
---|
[4465] | 26 | #time stuff |
---|
| 27 | time = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir |
---|
| 28 | build_time = time+'_build' |
---|
| 29 | run_time = time+'_run' |
---|
[3908] | 30 | |
---|
[4465] | 31 | #tide = -1.4 |
---|
[4546] | 32 | #tide = 0 |
---|
| 33 | tide = 1.4 |
---|
[3908] | 34 | |
---|
[4465] | 35 | #Maybe will try to make project a class to allow these parameters to be passed in. |
---|
| 36 | alpha = 0.1 |
---|
| 37 | friction=0.01 |
---|
| 38 | starttime=3600 |
---|
| 39 | finaltime=25000 |
---|
[4544] | 40 | setup='final' |
---|
[4587] | 41 | #source='onslow' |
---|
[4546] | 42 | #source='dampier' |
---|
[4587] | 43 | source='exmouth' |
---|
[3908] | 44 | |
---|
[4465] | 45 | if setup =='trial': |
---|
| 46 | print'trial' |
---|
| 47 | res_factor=10 |
---|
| 48 | time_thinning=48 |
---|
| 49 | yieldstep=240 |
---|
| 50 | if setup =='basic': |
---|
| 51 | print'basic' |
---|
| 52 | res_factor=4 |
---|
| 53 | time_thinning=12 |
---|
| 54 | yieldstep=120 |
---|
| 55 | if setup =='final': |
---|
| 56 | print'final' |
---|
| 57 | res_factor=1 |
---|
[4587] | 58 | time_thinning=4 |
---|
[4465] | 59 | yieldstep=60 |
---|
[4509] | 60 | if setup =='store': |
---|
| 61 | print'store' |
---|
| 62 | res_factor=10 |
---|
| 63 | time_thinning=48 |
---|
| 64 | yieldstep=240 |
---|
[3908] | 65 | |
---|
[4509] | 66 | |
---|
[4546] | 67 | dir_comment='_'+setup+'_'+str(tide)+'_'+str(source)+'_'+str(user) |
---|
[3908] | 68 | |
---|
[4465] | 69 | onshore_name = 'DLI' |
---|
| 70 | onshore_name1 = 'DTED' |
---|
| 71 | # offshore |
---|
| 72 | offshore_name = 'Exmouth_bathymetry' |
---|
| 73 | #offshore_name1 = 'inferred_north' |
---|
| 74 | #offshore_name2 = 'inferred_south' |
---|
| 75 | coast_name = 'Exmouth_coastline' |
---|
[3908] | 76 | |
---|
[4465] | 77 | #final topo name |
---|
| 78 | combined_name ='exmouth_combined_elevation' |
---|
| 79 | #combined_name1 ='exmouth_combined_elevation1' |
---|
| 80 | #combined_name_unclipped1 ='exmouth_combined_elevation_unclipped1' |
---|
| 81 | combined_small_name = 'exmouth_combined_elevation_small' |
---|
[3908] | 82 | |
---|
[4465] | 83 | anuga_dir = home+state+sep+scenario+sep+'anuga'+sep |
---|
[3908] | 84 | |
---|
[4465] | 85 | topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep |
---|
| 86 | topographies_dir = anuga_dir+'topographies'+sep |
---|
[3908] | 87 | |
---|
[4465] | 88 | # input topo file location |
---|
| 89 | onshore_in_dir_name = topographies_in_dir + onshore_name |
---|
| 90 | onshore1_in_dir_name = topographies_in_dir + onshore_name1 |
---|
| 91 | coast_in_dir_name = topographies_in_dir + coast_name |
---|
| 92 | offshore_in_dir_name = topographies_in_dir + offshore_name |
---|
| 93 | #offshore_in_dir_name1 = topographies_in_dir + offshore_name1 |
---|
| 94 | #offshore_in_dir_name2 = topographies_in_dir + offshore_name2 |
---|
[3908] | 95 | |
---|
[4465] | 96 | onshore_dir_name = topographies_dir + onshore_name |
---|
| 97 | onshore1_dir_name = topographies_dir + onshore_name1 |
---|
| 98 | coast_dir_name = topographies_dir + coast_name |
---|
| 99 | offshore_dir_name = topographies_dir + offshore_name |
---|
| 100 | #offshore_dir_name1 = topographies_dir + offshore_name1 |
---|
| 101 | #offshore_dir_name2 = topographies_dir + offshore_name2 |
---|
| 102 | |
---|
| 103 | #final topo files |
---|
| 104 | combined_dir_name = topographies_dir + combined_name |
---|
| 105 | #combined_dir_name_unclipped1 = topographies_dir + combined_name_unclipped1 |
---|
| 106 | #combined_dir_name1 = topographies_dir + combined_name1 |
---|
[4476] | 107 | combined_small_dir_name = topographies_dir + combined_small_name |
---|
[4465] | 108 | |
---|
| 109 | meshes_dir = anuga_dir+'meshes'+sep |
---|
| 110 | meshes_dir_name = meshes_dir + scenario_name |
---|
| 111 | |
---|
| 112 | polygons_dir = anuga_dir+'polygons'+sep |
---|
| 113 | tide_dir = anuga_dir+'tide_data'+sep |
---|
| 114 | |
---|
[4546] | 115 | if source =='dampier': |
---|
| 116 | boundaries_name = 'exmouth_3854_17042007' #Dampier gun |
---|
| 117 | boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'dampier'+sep+'1_10000'+sep |
---|
| 118 | |
---|
| 119 | if source=='onslow': |
---|
[4587] | 120 | boundaries_name = 'exmouth_3859_16052007' #onslow_hedland_broome gun |
---|
[4546] | 121 | boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'onslow_hedland_broome'+sep+'1_10000'+sep |
---|
| 122 | |
---|
| 123 | if source=='exmouth': |
---|
[4587] | 124 | boundaries_name = 'exmouth_3103_18052007' #exmouth gun |
---|
[4546] | 125 | boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'exmouth'+sep+'1_10000'+sep |
---|
| 126 | |
---|
[4465] | 127 | #boundaries locations |
---|
[4546] | 128 | boundaries_source = '' |
---|
| 129 | #boundaries_in_dir = anuga_dir+'boundaries'+sep |
---|
[4465] | 130 | boundaries_in_dir_name = boundaries_in_dir + boundaries_name |
---|
| 131 | |
---|
| 132 | #output locations |
---|
| 133 | output_dir = anuga_dir+'outputs'+sep |
---|
| 134 | output_build_time_dir = output_dir+build_time+sep |
---|
[5408] | 135 | output_run_time_dir = output_dir +run_time+dir_comment+sep |
---|
| 136 | #output_run_time_dir = output_dir +'20070619_042140_run_final_0_onslow_nbartzis'+sep |
---|
[4465] | 137 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
| 138 | |
---|
| 139 | #gauges |
---|
[4580] | 140 | beach_gauges = 'beach_gauges.csv' |
---|
[4465] | 141 | gauge_name = 'exmouth_gauges.csv' |
---|
[4581] | 142 | |
---|
[4465] | 143 | gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep |
---|
[4581] | 144 | beach_gauges = gauges_dir + 'beach_gauges.csv' |
---|
[4465] | 145 | gauges_dir_name = gauges_dir + gauge_name |
---|
| 146 | |
---|
| 147 | community_filename = gauges_dir + 'CHINS_v2.csv' |
---|
| 148 | community_exmouth = gauges_dir + 'community_exmouth.csv' |
---|
| 149 | |
---|
[4525] | 150 | buildings_filename = gauges_dir +'Exmouth_res_Project.csv' |
---|
| 151 | buildings_filename_out = output_run_time_dir +'Exmouth_res_Project_modified.csv' |
---|
[4228] | 152 | |
---|
[3908] | 153 | ############################### |
---|
| 154 | # Domain definitions |
---|
| 155 | ############################### |
---|
[4856] | 156 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon |
---|
[3908] | 157 | |
---|
[4476] | 158 | poly_all = read_polygon(polygons_dir+'extent_more_points.csv') |
---|
[3908] | 159 | |
---|
[4399] | 160 | print 'Area of bounding polygon', polygon_area(poly_all)/1000000.0 |
---|
[3908] | 161 | |
---|
[4465] | 162 | res_poly_all = 150000*res_factor |
---|
| 163 | |
---|
| 164 | ############################### |
---|
| 165 | # Interior region definitions |
---|
| 166 | ############################### |
---|
| 167 | |
---|
| 168 | |
---|
[4544] | 169 | poly_coast = read_polygon(polygons_dir+'coast_new_pts.csv') |
---|
| 170 | #poly_coast = read_polygon(polygons_dir+'pts_coast.csv') |
---|
[4476] | 171 | res_coast = 10000*res_factor |
---|
[4465] | 172 | |
---|
[4546] | 173 | #poly_coast1 = read_polygon(polygons_dir+'pts_coast1.csv') |
---|
[4476] | 174 | #res_0 = 20000*res_factor |
---|
[4465] | 175 | |
---|
[4544] | 176 | poly_coast2 = read_polygon(polygons_dir+'coast2_new_pts.csv') |
---|
| 177 | #poly_coast2 = read_polygon(polygons_dir+'pts_coast2.csv') |
---|
[4476] | 178 | #res_0 = 20000*res_factor |
---|
[4465] | 179 | |
---|
[4476] | 180 | poly_coast3 = read_polygon(polygons_dir+'pts_coast3.csv') |
---|
| 181 | #res_0 = 20000*res_factor |
---|
[4465] | 182 | |
---|
[4544] | 183 | poly_exmouth = read_polygon(polygons_dir+'exmouth_new_pts.csv') |
---|
| 184 | #poly_exmouth = read_polygon(polygons_dir+'pts_exmouth.csv') |
---|
[4476] | 185 | res_exmouth = 500*res_factor |
---|
| 186 | |
---|
[4544] | 187 | poly_exmouth_south = read_polygon(polygons_dir+'exmouth_south_pts.csv') |
---|
| 188 | #res_exmouth = 500*res_factor |
---|
| 189 | |
---|
| 190 | poly_carpark1 = read_polygon(polygons_dir+'carpark1_pts.csv') |
---|
| 191 | #res_exmouth = 500*res_factor |
---|
| 192 | |
---|
| 193 | poly_carpark2 = read_polygon(polygons_dir+'carpark2_pts.csv') |
---|
| 194 | #res_exmouth = 500*res_factor |
---|
| 195 | |
---|
| 196 | poly_carpark3 = read_polygon(polygons_dir+'carpark3_pts.csv') |
---|
| 197 | #res_exmouth = 500*res_factor |
---|
| 198 | |
---|
[4476] | 199 | poly_nth_defence = read_polygon(polygons_dir+'pts_nth_defence.csv') |
---|
| 200 | res_nth_defence = 5000*res_factor |
---|
| 201 | |
---|
[4544] | 202 | poly_middle = read_polygon(polygons_dir+'middle_new_pts.csv') |
---|
| 203 | #poly_middle = read_polygon(polygons_dir+'pts_middle.csv') |
---|
[4476] | 204 | res_middle = 30000*res_factor |
---|
| 205 | |
---|
| 206 | poly_airport = read_polygon(polygons_dir+'pts_airport.csv') |
---|
| 207 | res_airport = 5000*res_factor |
---|
| 208 | |
---|
[4546] | 209 | interior_regions = [[poly_coast,res_coast],[poly_coast2,res_coast] |
---|
[4476] | 210 | ,[poly_coast3,res_coast],[poly_middle,res_middle],[poly_exmouth,res_exmouth] |
---|
[4544] | 211 | ,[poly_exmouth_south,res_exmouth],[poly_carpark1,res_exmouth],[poly_carpark2,res_exmouth] |
---|
| 212 | ,[poly_carpark3,res_exmouth],[poly_nth_defence,res_nth_defence],[poly_airport,res_airport]] |
---|
[4476] | 213 | |
---|
[4465] | 214 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
| 215 | |
---|
| 216 | print 'min number triangles', trigs_min |
---|
| 217 | |
---|
| 218 | poly_mainland = read_polygon(polygons_dir+'Initial_Condition.csv') |
---|
[4476] | 219 | |
---|
[3908] | 220 | ################################################################### |
---|
| 221 | # Clipping regions for export to asc and regions for clipping data |
---|
| 222 | ################################################################### |
---|
| 223 | |
---|
[4856] | 224 | # exporting asc grid - Exmouth town area |
---|
[4534] | 225 | eastingmin = 200663 |
---|
[4587] | 226 | eastingmax = 207500 |
---|
[4534] | 227 | northingmax = 7574000 |
---|
| 228 | northingmin = 7564500 |
---|
[4856] | 229 | |
---|
| 230 | # exporting asc grid - carparks etc on NW peninsula |
---|
| 231 | e_min_area = 192700 |
---|
| 232 | e_max_area = 203755 |
---|
| 233 | n_max_area = 7587330 |
---|
| 234 | n_min_area = 7579460 |
---|