[5000] | 1 | # -*- coding: cp1252 -*- |
---|
| 2 | """Common filenames and locations for topographic data, meshes and outputs. |
---|
| 3 | """ |
---|
| 4 | |
---|
| 5 | from os import sep, environ, getenv, getcwd ,umask |
---|
| 6 | from os.path import expanduser |
---|
| 7 | import sys |
---|
| 8 | from time import localtime, strftime, gmtime |
---|
| 9 | from anuga.utilities.polygon import read_polygon, plot_polygons, is_inside_polygon, number_mesh_triangles |
---|
| 10 | #from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees, convert_points_from_latlon_to_utm |
---|
| 11 | from anuga.utilities.system_tools import get_user_name, get_host_name |
---|
| 12 | |
---|
| 13 | # file and system info |
---|
| 14 | #--------------------------------- |
---|
[5415] | 15 | #codename = 'project.py' |
---|
[5000] | 16 | |
---|
| 17 | home = getenv('INUNDATIONHOME') + sep +'data'+sep #Sandpit's parent dir |
---|
| 18 | user = get_user_name() |
---|
| 19 | host = get_host_name() |
---|
[5415] | 20 | |
---|
[5000] | 21 | # INUNDATIONHOME is the inundation directory, not the data directory. |
---|
| 22 | |
---|
| 23 | #time stuff |
---|
| 24 | time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir |
---|
[5415] | 25 | gtime = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir |
---|
[5000] | 26 | build_time = time+'_build' |
---|
| 27 | run_time = time+'_run' |
---|
[5415] | 28 | print 'gtime: ', gtime |
---|
[5000] | 29 | |
---|
| 30 | #Making assumptions about the location of scenario data |
---|
| 31 | state = 'western_australia' |
---|
| 32 | scenario_name = 'busselton' |
---|
[5149] | 33 | scenario = 'busselton_tsunami_scenario' |
---|
[5000] | 34 | |
---|
[5526] | 35 | tide = 0 |
---|
[5415] | 36 | |
---|
[5479] | 37 | alpha = 0.1 |
---|
[5000] | 38 | friction=0.01 |
---|
[5408] | 39 | starttime=0 |
---|
[5448] | 40 | finaltime=50000 # changed for rev_number trial |
---|
[5408] | 41 | export_cellsize=25 |
---|
[5526] | 42 | setup='final' |
---|
[5387] | 43 | source='exmouth' |
---|
[5000] | 44 | |
---|
| 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 | |
---|
[5526] | 62 | rev_num = 'newExtent' |
---|
[5457] | 63 | #rev_num = '5449' |
---|
[5448] | 64 | #rev_num = '4695' # 2nd Sept 2007 |
---|
| 65 | #rev_num = '4743' # 3nd Oct 2007 |
---|
| 66 | #rev_num = '4777' # 1st Nov 2007 |
---|
| 67 | #rev_num = '4874' # 3rd Dec 2007 |
---|
| 68 | #rev_num = '4901' # 3rd Jan 2007 |
---|
| 69 | #rev_num = '4990' # 5th Feb 2007 |
---|
| 70 | #rev_num = '5103' # 3rd March 2007 |
---|
[5472] | 71 | #rev_num = '5120' # 5th March 2007 |
---|
| 72 | #rev_num = '5140' # 7th March 2007 |
---|
[5526] | 73 | #rev_num = '5160' # 11th March 2007 |
---|
[5448] | 74 | #rev_num = '5185' # 1st April 2007 |
---|
[5479] | 75 | #rev_num = '5273' # 2nd May 2007 |
---|
[5000] | 76 | |
---|
| 77 | |
---|
[5444] | 78 | dir_comment='_'+setup+'_'+str(tide)+'_'+str(source)+'_'+str(rev_num)+'_'+str(user) |
---|
[5000] | 79 | |
---|
[5415] | 80 | |
---|
| 81 | # onshore data provided by WA DLI - provided by Hamish on the 17th June 2008 |
---|
| 82 | |
---|
| 83 | onshore_name = 'busselton_v2_gda94_mga50' # original |
---|
| 84 | |
---|
[5000] | 85 | # AHO + DPI data |
---|
[5526] | 86 | coast_name = 'Busselton_Contour0' # provided by hamish, represent better coastline than the 100km as compared to charts |
---|
| 87 | coast_name1 = 'Busselton_BeachSurvey' |
---|
| 88 | offshore_name = 'Busselton_NavyFinal' |
---|
[5415] | 89 | offshore_name1 = 'Busselton_Chart' |
---|
| 90 | offshore_name2 = 'Busselton_Digitised' |
---|
[5526] | 91 | offshore_name3 = 'Busselton_250m' # for areas that were heading to zero - 2005 Bathymetry grid |
---|
[5000] | 92 | |
---|
[5526] | 93 | |
---|
[5000] | 94 | #final topo name |
---|
[5149] | 95 | combined_name ='busselton_combined_elevation' |
---|
| 96 | combined_name_small = 'busselton_combined_elevation_smaller' |
---|
[5000] | 97 | |
---|
| 98 | anuga_dir = home+state+sep+scenario+sep+'anuga'+sep |
---|
| 99 | |
---|
[5149] | 100 | topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep |
---|
[5415] | 101 | topographies_dir = anuga_dir+'topographies'+sep |
---|
[5000] | 102 | |
---|
[5381] | 103 | # input topo file location |
---|
| 104 | onshore_in_dir_name = topographies_in_dir + onshore_name #topo |
---|
[5000] | 105 | |
---|
[5381] | 106 | coast_in_dir_name = topographies_in_dir + coast_name #coastline |
---|
| 107 | coast_in_dir_name1 = topographies_in_dir + coast_name1 #beach survey |
---|
[5415] | 108 | |
---|
[5381] | 109 | offshore_in_dir_name = topographies_in_dir + offshore_name #bathymetry |
---|
[5415] | 110 | offshore_in_dir_name1 = topographies_in_dir + offshore_name1 #bathymetry Charts |
---|
| 111 | offshore_in_dir_name2 = topographies_in_dir + offshore_name2 #Digitised Fairsheet |
---|
[5526] | 112 | offshore_in_dir_name3 = topographies_in_dir + offshore_name3 #250m |
---|
[5000] | 113 | |
---|
[5381] | 114 | #output to anuga from build file |
---|
[5000] | 115 | onshore_dir_name = topographies_dir + onshore_name |
---|
[5381] | 116 | |
---|
[5000] | 117 | coast_dir_name = topographies_dir + coast_name |
---|
[5149] | 118 | coast_dir_name1 = topographies_dir + coast_name1 |
---|
[5415] | 119 | |
---|
[5000] | 120 | offshore_dir_name = topographies_dir + offshore_name |
---|
[5415] | 121 | offshore_dir_name1 = topographies_dir + offshore_name1 |
---|
| 122 | offshore_dir_name2 = topographies_dir + offshore_name2 |
---|
[5526] | 123 | offshore_dir_name3 = topographies_dir + offshore_name3 |
---|
[5000] | 124 | |
---|
| 125 | #final topo files |
---|
| 126 | combined_dir_name = topographies_dir + combined_name |
---|
[5149] | 127 | combined_dir_name_small = topographies_dir + combined_name_small |
---|
[5000] | 128 | |
---|
| 129 | meshes_dir = anuga_dir+'meshes'+sep |
---|
| 130 | meshes_dir_name = meshes_dir + scenario_name |
---|
| 131 | |
---|
[5526] | 132 | polygons_dir = anuga_dir+'polygons'+sep+'New_Extents'+sep |
---|
[5000] | 133 | tide_dir = anuga_dir+'tide_data'+sep |
---|
| 134 | |
---|
[5415] | 135 | #boundaries_source = '1' |
---|
| 136 | |
---|
[5000] | 137 | if source=='exmouth': |
---|
[5387] | 138 | boundaries_name = 'busselton_3103_30052008' #exmouth gun |
---|
[5000] | 139 | boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'exmouth'+sep+'1_10000'+sep |
---|
| 140 | |
---|
[5387] | 141 | if source=='test': |
---|
| 142 | boundaries_name = 'other' #exmouth gun |
---|
[5415] | 143 | boundaries_in_dir = anuga_dir+'boundaries'+sep |
---|
[5000] | 144 | |
---|
| 145 | |
---|
| 146 | #boundaries locations |
---|
| 147 | boundaries_in_dir_name = boundaries_in_dir + boundaries_name |
---|
| 148 | boundaries_dir = anuga_dir+'boundaries'+sep |
---|
| 149 | boundaries_dir_name = boundaries_dir + scenario_name |
---|
| 150 | |
---|
| 151 | #output locations |
---|
| 152 | output_dir = anuga_dir+'outputs'+sep |
---|
[5526] | 153 | #output_build_time_dir = output_dir +'test'+sep + build_time + dir_comment + sep |
---|
| 154 | output_build_time_dir = output_dir +build_time + dir_comment + sep |
---|
[5000] | 155 | #output_run_time_dir = output_dir +run_time+dir_comment+sep |
---|
[5415] | 156 | output_run_time_dir = output_dir +'test'+sep + run_time + dir_comment +sep # take test out |
---|
[5000] | 157 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
| 158 | |
---|
| 159 | #gauges |
---|
[5415] | 160 | gauge_name = 'busselton.csv' |
---|
[5149] | 161 | gauges_dir = home+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep |
---|
[5000] | 162 | gauges_dir_name = gauges_dir + gauge_name |
---|
| 163 | |
---|
| 164 | buildings_filename = gauges_dir + 'Busselton_res_Project.csv' |
---|
| 165 | buildings_filename_out = 'Busselton_res_Project_modified.csv' |
---|
| 166 | |
---|
| 167 | community_filename = gauges_dir +'' |
---|
| 168 | community_broome = gauges_dir + '' |
---|
| 169 | |
---|
| 170 | |
---|
| 171 | ############################### |
---|
| 172 | # Domain definitions |
---|
| 173 | ############################### |
---|
| 174 | |
---|
| 175 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon |
---|
| 176 | |
---|
| 177 | # bounding polygon for study area |
---|
[5526] | 178 | poly_all = read_polygon(polygons_dir+'poly_all_extend.csv') |
---|
[5000] | 179 | res_poly_all = 100000*res_factor |
---|
| 180 | |
---|
| 181 | |
---|
| 182 | ############################### |
---|
| 183 | # Interior region definitions |
---|
| 184 | ############################### |
---|
| 185 | |
---|
| 186 | #digitized polygons |
---|
[5415] | 187 | poly_large = read_polygon(polygons_dir+'coast_5km_d20m.csv') |
---|
[5444] | 188 | res_large = 40000*res_factor |
---|
[5149] | 189 | |
---|
[5415] | 190 | poly_busselton = read_polygon(polygons_dir+'busselton_1km.csv') |
---|
| 191 | res_busselton = 500*res_factor |
---|
[5000] | 192 | |
---|
[5415] | 193 | poly_bunbury = read_polygon(polygons_dir+'bunbury_1km.csv') |
---|
| 194 | res_bunbury = 500*res_factor |
---|
[5000] | 195 | |
---|
[5430] | 196 | poly_dunsborough = read_polygon(polygons_dir+'dunsborough_1km.csv') |
---|
| 197 | res_dunsborough = 500*res_factor |
---|
[5000] | 198 | |
---|
[5430] | 199 | poly_busselton2 = read_polygon(polygons_dir+'busselton_2km.csv') |
---|
| 200 | res_busselton2 = 10000*res_factor |
---|
[5000] | 201 | |
---|
[5444] | 202 | poly_bunbury2 = read_polygon(polygons_dir+'bunbury_2km.csv') |
---|
| 203 | res_bunbury2 = 10000*res_factor |
---|
[5415] | 204 | |
---|
[5430] | 205 | |
---|
| 206 | interior_regions = [[poly_large,res_large],[poly_busselton,res_busselton],[poly_bunbury,res_bunbury] |
---|
[5444] | 207 | ,[poly_dunsborough,res_dunsborough],[poly_busselton2,res_busselton2] |
---|
| 208 | ,[poly_bunbury2,res_bunbury2]] |
---|
[5430] | 209 | |
---|
| 210 | |
---|
[5526] | 211 | boundary_tags={'back': [3, 4, 5, 6, 7], |
---|
| 212 | 'side': [2, 8], 'ocean': [0, 1, 9]} |
---|
[5415] | 213 | |
---|
[5000] | 214 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
| 215 | |
---|
[5387] | 216 | poly_mainland=read_polygon(polygons_dir+'initial_condition.csv') |
---|
[5000] | 217 | |
---|
| 218 | print 'min number triangles', trigs_min |
---|
| 219 | |
---|
| 220 | |
---|
[5415] | 221 | ################################################################### |
---|
| 222 | # Clipping regions for export to asc and regions for clipping data |
---|
| 223 | ################################################################### |
---|
| 224 | |
---|
| 225 | # exporting asc grid for Busselton |
---|
[5444] | 226 | xminBusselton = 340000 |
---|
| 227 | xmaxBusselton = 352000 |
---|
| 228 | yminBusselton = 6271500 |
---|
| 229 | ymaxBusselton = 6280000 |
---|
[5415] | 230 | |
---|
[5444] | 231 | # exporting asc grid for Bunbury |
---|
| 232 | xminBunbury = 369000 |
---|
| 233 | xmaxBunbury = 381000 |
---|
| 234 | yminBunbury = 6308000 |
---|
[5501] | 235 | ymaxBunbury = 6316500 |
---|
[5444] | 236 | |
---|
| 237 | # exporting asc grid for Dunsborough |
---|
| 238 | xminDunsborough = 321000 |
---|
| 239 | xmaxDunsborough = 327500 |
---|
| 240 | yminDunsborough = 6277000 |
---|
| 241 | ymaxDunsborough = 6282000 |
---|
| 242 | |
---|