[5635] | 1 | """ Designed from run_perth 08/08/2008 """ |
---|
| 2 | |
---|
| 3 | # -*- coding: cp1252 -*- |
---|
| 4 | """Common filenames and locations for topographic data, meshes and outputs. |
---|
| 5 | """ |
---|
| 6 | |
---|
| 7 | from os import sep, environ, getenv, getcwd |
---|
| 8 | from os.path import expanduser |
---|
| 9 | import sys |
---|
| 10 | from time import localtime, strftime, gmtime |
---|
| 11 | from anuga.utilities.polygon import read_polygon, plot_polygons, is_inside_polygon, number_mesh_triangles |
---|
| 12 | #from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees, convert_points_from_latlon_to_utm |
---|
| 13 | from anuga.utilities.system_tools import get_user_name, get_host_name |
---|
| 14 | from anuga.shallow_water.data_manager import urs2sts,create_sts_boundary |
---|
| 15 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon |
---|
| 16 | |
---|
| 17 | # file and system info |
---|
| 18 | #--------------------------------- |
---|
| 19 | #codename = 'project.py' |
---|
| 20 | |
---|
| 21 | home = getenv('INUNDATIONHOME') + sep +'data'+sep #Sandpit's parent diruser = get_user_name() |
---|
| 22 | muxhome = getenv('MUXHOME') |
---|
| 23 | user = get_user_name() |
---|
| 24 | host = get_host_name() |
---|
| 25 | |
---|
| 26 | # INUNDATIONHOME is the inundation directory, not the data directory. |
---|
| 27 | |
---|
| 28 | #time stuff |
---|
| 29 | time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir |
---|
| 30 | gtime = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir |
---|
| 31 | build_time = time+'_build' |
---|
| 32 | run_time = time+'_run' |
---|
| 33 | print 'gtime: ', gtime |
---|
| 34 | |
---|
| 35 | #Making assumptions about the location of scenario data |
---|
| 36 | state = 'western_australia' |
---|
| 37 | #scenario_name = 'perth_44unitsources' |
---|
| 38 | scenario_name = 'onslow_2008' |
---|
| 39 | scenario = 'onslow_tsunami_scenario_2008' |
---|
| 40 | |
---|
| 41 | |
---|
[5669] | 42 | tide = 1.5 |
---|
[5635] | 43 | |
---|
| 44 | alpha = 0.1 |
---|
| 45 | friction=0.01 |
---|
[5669] | 46 | starttime=5000 |
---|
[5635] | 47 | finaltime=80000 |
---|
| 48 | export_cellsize=25 |
---|
[5669] | 49 | setup='trial' |
---|
[5635] | 50 | source='polyline' |
---|
| 51 | |
---|
| 52 | if setup =='trial': |
---|
| 53 | print'trial' |
---|
| 54 | res_factor=10 |
---|
| 55 | time_thinning=48 |
---|
| 56 | yieldstep=240 |
---|
| 57 | if setup =='basic': |
---|
| 58 | print'basic' |
---|
| 59 | res_factor=4 |
---|
| 60 | time_thinning=12 |
---|
| 61 | yieldstep=120 |
---|
| 62 | if setup =='final': |
---|
| 63 | print'final' |
---|
| 64 | res_factor=1 |
---|
| 65 | time_thinning=4 |
---|
| 66 | yieldstep=60 |
---|
| 67 | |
---|
| 68 | dir_comment='_'+setup+'_'+str(tide)+'_'+str(source)+'_'+ 'alpha' +str(alpha)+'_'+str(user) |
---|
| 69 | |
---|
| 70 | # onshore data provided by WA DLI |
---|
| 71 | onshore_name = 'revised_onshore_20m_dli' #revised |
---|
| 72 | |
---|
| 73 | #island |
---|
| 74 | island_name = 'onslow_islands_dted2' # revised |
---|
| 75 | |
---|
| 76 | # AHO + DPI data + colin French coastline |
---|
| 77 | coast_name = 'revised_coastline' |
---|
| 78 | offshore_name = 'onslow_offshore_points' |
---|
| 79 | offshore_name1 = 'beach_survey' |
---|
| 80 | offshore_name2 = 'ONS16FINAL' |
---|
| 81 | offshore_name3 = 'ONS17FINAL' |
---|
| 82 | offshore_name4 = 'ONS18FINAL' |
---|
| 83 | |
---|
| 84 | |
---|
| 85 | #final topo name |
---|
| 86 | combined_name ='onslow_combined_elevation' |
---|
| 87 | combined_smaller_name = 'onslow_combined_elevation_smaller' |
---|
| 88 | |
---|
| 89 | anuga_dir = home+state+sep+scenario+sep+'anuga'+sep |
---|
| 90 | |
---|
| 91 | topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep |
---|
| 92 | topographies_dir = anuga_dir+'topographies'+sep |
---|
| 93 | #topographies_time_dir = topographies_dir+build_time+sep |
---|
| 94 | |
---|
| 95 | # input topo file location |
---|
| 96 | onshore_in_dir_name = topographies_in_dir + onshore_name |
---|
| 97 | island_in_dir_name = topographies_in_dir + island_name |
---|
| 98 | |
---|
| 99 | coast_in_dir_name = topographies_in_dir + coast_name |
---|
| 100 | offshore_in_dir_name = topographies_in_dir + offshore_name |
---|
| 101 | offshore_in_dir_name1 = topographies_in_dir + offshore_name1 |
---|
| 102 | offshore_in_dir_name2 = topographies_in_dir + offshore_name2 |
---|
| 103 | offshore_in_dir_name3 = topographies_in_dir + offshore_name3 |
---|
| 104 | offshore_in_dir_name4 = topographies_in_dir + offshore_name4 |
---|
| 105 | |
---|
| 106 | onshore_dir_name = topographies_dir + onshore_name |
---|
| 107 | island_dir_name = topographies_dir + island_name |
---|
| 108 | |
---|
| 109 | coast_dir_name = topographies_dir + coast_name |
---|
| 110 | offshore_dir_name = topographies_dir + offshore_name |
---|
| 111 | offshore_dir_name1 = topographies_dir + offshore_name1 |
---|
| 112 | offshore_dir_name2 = topographies_dir + offshore_name2 |
---|
| 113 | offshore_dir_name3 = topographies_dir + offshore_name3 |
---|
| 114 | offshore_dir_name4 = topographies_dir + offshore_name4 |
---|
| 115 | |
---|
| 116 | #final topo files |
---|
| 117 | combined_dir_name = topographies_dir + combined_name |
---|
| 118 | #combined_time_dir_name = topographies_time_dir + combined_name |
---|
| 119 | combined_smaller_name_dir = topographies_dir + combined_smaller_name |
---|
| 120 | #combined_time_dir_final_name = topographies_time_dir + combined_final_name |
---|
| 121 | |
---|
| 122 | meshes_dir = anuga_dir+'meshes'+sep |
---|
| 123 | meshes_dir_name = meshes_dir + scenario_name |
---|
| 124 | |
---|
| 125 | polygons_dir = anuga_dir+'polygons'+sep |
---|
| 126 | tide_dir = anuga_dir+'tide_data'+sep |
---|
| 127 | |
---|
| 128 | |
---|
| 129 | #boundaries_source = '1' |
---|
| 130 | |
---|
| 131 | if source=='polyline': |
---|
| 132 | boundaries_name = 'perth_3103_28052008' #polyline gun |
---|
| 133 | boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'polyline'+sep+'1_10000'+sep |
---|
| 134 | |
---|
| 135 | if source=='test': |
---|
| 136 | boundaries_name = 'other' #polyline |
---|
| 137 | boundaries_in_dir = anuga_dir+'boundaries'+sep |
---|
| 138 | |
---|
| 139 | |
---|
| 140 | #boundaries locations |
---|
| 141 | boundaries_in_dir_name = boundaries_in_dir + boundaries_name |
---|
| 142 | boundaries_dir = anuga_dir+'boundaries'+sep |
---|
| 143 | boundaries_dir_name = boundaries_dir + scenario_name # what it creates??? |
---|
| 144 | boundaries_dir_mux = muxhome |
---|
| 145 | |
---|
| 146 | #output locations |
---|
| 147 | output_dir = anuga_dir+'outputs'+sep |
---|
| 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 |
---|
| 150 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
| 151 | |
---|
| 152 | vertex_filename = output_run_time_dir + 'mesh_vertex.csv' |
---|
| 153 | |
---|
| 154 | #gauges |
---|
| 155 | gauge_name = 'gauge_location_onslow.csv' |
---|
| 156 | gauge_name2 = 'thinned_MGA50+1.csv' |
---|
| 157 | |
---|
| 158 | gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep |
---|
| 159 | beach_gauges = gauges_dir + 'beach_gauges.csv' |
---|
| 160 | gauges_dir_name = gauges_dir + gauge_name |
---|
| 161 | gauges_dir_name2 = gauges_dir + gauge_name2 |
---|
| 162 | |
---|
| 163 | |
---|
| 164 | #buildings_filename = gauges_dir + 'Onslow_res_Project.csv' |
---|
| 165 | #buildings_filename_out = 'Onslow_res_Project_modified.csv' |
---|
| 166 | |
---|
| 167 | |
---|
| 168 | ############################### |
---|
| 169 | # Interior region definitions |
---|
| 170 | ############################### |
---|
| 171 | |
---|
| 172 | #Initial bounding polygon for data clipping |
---|
| 173 | poly_all = read_polygon(polygons_dir+'domain.csv') |
---|
| 174 | res_poly_all = 100000*res_factor |
---|
| 175 | |
---|
| 176 | #Polygon designed by 20m contours, or 3km from the coastline |
---|
| 177 | poly_inner_region = read_polygon(polygons_dir+'inner_region.csv') |
---|
| 178 | res_inner_region = 5000*res_factor |
---|
| 179 | |
---|
| 180 | #Polygon designed to cut out the rottnest island land. |
---|
| 181 | poly_region_50m = read_polygon(polygons_dir+'region_50m.csv') |
---|
| 182 | res_region_50m = 50000*res_factor |
---|
| 183 | |
---|
| 184 | #Polygon designed to incorporate Garden Island and sand bank infront of Rockingham |
---|
| 185 | poly_onslow_v2 = read_polygon(polygons_dir+'onslow_v2.csv') |
---|
| 186 | res_onslow_v2 = 500*res_factor |
---|
| 187 | |
---|
| 188 | #Polygon designed to incorporate coastline of rottnest |
---|
| 189 | poly_beach_left = read_polygon(polygons_dir+'beach_left.csv') |
---|
| 190 | res_beach_left = 200*res_factor |
---|
| 191 | |
---|
| 192 | #Polygon designed to incorporate perth and Fremantle CBD |
---|
| 193 | poly_beach_right = read_polygon(polygons_dir+'beach_right.csv') |
---|
| 194 | res_beach_right = 200*res_factor |
---|
| 195 | |
---|
| 196 | |
---|
| 197 | |
---|
| 198 | #assert zone == refzone |
---|
| 199 | |
---|
| 200 | interior_regions = [[poly_inner_region,res_inner_region],[poly_region_50m,res_region_50m] |
---|
| 201 | ,[poly_onslow_v2,res_onslow_v2],[poly_beach_left,res_beach_left] |
---|
| 202 | ,[poly_beach_right,res_beach_right]] |
---|
| 203 | |
---|
| 204 | |
---|
| 205 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
| 206 | print 'min number triangles', trigs_min |
---|
| 207 | |
---|
| 208 | |
---|
| 209 | poly_mainland = read_polygon(topographies_in_dir+'InitialCondition_points.csv') |
---|
| 210 | |
---|
| 211 | ################################################################### |
---|
| 212 | # Clipping regions for export to asc and regions for clipping data |
---|
| 213 | ################################################################### |
---|
| 214 | |
---|
| 215 | # region to export (used from export_results.py) |
---|
| 216 | e_min_area = 300000 # Eastings min |
---|
| 217 | e_max_area = 310000 |
---|
| 218 | n_min_area = 7600000 |
---|
| 219 | n_max_area = 7610000 |
---|
| 220 | # for old onslow town |
---|
| 221 | ##e_min_area = 300000 # Eastings min |
---|
| 222 | ##e_max_area = 310000 |
---|
| 223 | ##n_min_area = 7600000 |
---|
| 224 | ##n_max_area = 7610000 |
---|