[5005] | 1 | # -*- coding: cp1252 -*- |
---|
| 2 | """Common filenames and locations for topographic data, meshes and outputs. |
---|
| 3 | """ |
---|
| 4 | |
---|
[5755] | 5 | from os import sep, environ, getenv, getcwd |
---|
[5005] | 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 |
---|
[5755] | 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 |
---|
[5005] | 14 | |
---|
| 15 | # file and system info |
---|
| 16 | #--------------------------------- |
---|
[5755] | 17 | #codename = 'project.py' |
---|
[5005] | 18 | |
---|
[5755] | 19 | home = getenv('INUNDATIONHOME') + sep +'data'+sep #Sandpit's parent diruser = get_user_name() |
---|
| 20 | muxhome = getenv('MUXHOME') |
---|
[5005] | 21 | user = get_user_name() |
---|
| 22 | host = get_host_name() |
---|
[5755] | 23 | |
---|
[5005] | 24 | # INUNDATIONHOME is the inundation directory, not the data directory. |
---|
| 25 | |
---|
| 26 | #time stuff |
---|
| 27 | time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir |
---|
[5755] | 28 | gtime = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir |
---|
[5005] | 29 | build_time = time+'_build' |
---|
| 30 | run_time = time+'_run' |
---|
[5755] | 31 | print 'gtime: ', gtime |
---|
[5005] | 32 | |
---|
| 33 | #Making assumptions about the location of scenario data |
---|
| 34 | state = 'western_australia' |
---|
[5381] | 35 | scenario_name = 'carnarvon' |
---|
| 36 | scenario = 'carnarvon_tsunami_scenario' |
---|
[5005] | 37 | |
---|
[5755] | 38 | |
---|
| 39 | tide = 0.0 #1.0 |
---|
| 40 | |
---|
[5005] | 41 | alpha = 0.1 |
---|
| 42 | friction=0.01 |
---|
[5755] | 43 | starttime=0 |
---|
| 44 | finaltime=1000 |
---|
| 45 | export_cellsize=25 |
---|
[5005] | 46 | setup='final' |
---|
[5755] | 47 | source='polyline' |
---|
[5005] | 48 | |
---|
| 49 | if setup =='trial': |
---|
| 50 | print'trial' |
---|
| 51 | res_factor=10 |
---|
| 52 | time_thinning=48 |
---|
| 53 | yieldstep=240 |
---|
| 54 | if setup =='basic': |
---|
| 55 | print'basic' |
---|
| 56 | res_factor=4 |
---|
| 57 | time_thinning=12 |
---|
| 58 | yieldstep=120 |
---|
| 59 | if setup =='final': |
---|
| 60 | print'final' |
---|
| 61 | res_factor=1 |
---|
| 62 | time_thinning=4 |
---|
| 63 | yieldstep=60 |
---|
| 64 | |
---|
[5755] | 65 | dir_comment='_'+setup+'_'+str(tide)+'_'+str(source)+'_'+ 'alpha' +str(alpha)+'_'+str(user) |
---|
[5005] | 66 | |
---|
| 67 | # onshore data provided by WA DLI |
---|
[5755] | 68 | onshore_name = 'bathy250_clipland' # original |
---|
[5005] | 69 | |
---|
[5755] | 70 | # AHO + DPI data + colin French coastline |
---|
| 71 | coast_name = 'DPI_coastlineP' |
---|
| 72 | offshore_name = 'Shark_Bay_Clip' |
---|
| 73 | offshore_name1 = 'XYAHD_Clip' |
---|
| 74 | offshore_name2 = 'DPI_data' |
---|
[5005] | 75 | |
---|
[5755] | 76 | |
---|
[5005] | 77 | #final topo name |
---|
[5755] | 78 | combined_name = scenario_name+'_combined_elevation' |
---|
| 79 | combined_smaller_name = scenario_name+'_combined_elevation_smaller' |
---|
[5005] | 80 | |
---|
| 81 | anuga_dir = home+state+sep+scenario+sep+'anuga'+sep |
---|
| 82 | |
---|
[5755] | 83 | topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep |
---|
| 84 | topographies_dir = anuga_dir+'topographies'+sep |
---|
[5005] | 85 | |
---|
[5755] | 86 | # input topo file location |
---|
[5005] | 87 | onshore_in_dir_name = topographies_in_dir + onshore_name |
---|
| 88 | |
---|
| 89 | coast_in_dir_name = topographies_in_dir + coast_name |
---|
| 90 | offshore_in_dir_name = topographies_in_dir + offshore_name |
---|
[5755] | 91 | offshore_in_dir_name1 = topographies_in_dir + offshore_name1 |
---|
| 92 | offshore_in_dir_name2 = topographies_in_dir + offshore_name2 |
---|
[5005] | 93 | |
---|
| 94 | onshore_dir_name = topographies_dir + onshore_name |
---|
[5755] | 95 | |
---|
[5005] | 96 | coast_dir_name = topographies_dir + coast_name |
---|
| 97 | offshore_dir_name = topographies_dir + offshore_name |
---|
[5755] | 98 | offshore_dir_name1 = topographies_dir + offshore_name1 |
---|
| 99 | offshore_dir_name2 = topographies_dir + offshore_name2 |
---|
[5005] | 100 | |
---|
| 101 | #final topo files |
---|
| 102 | combined_dir_name = topographies_dir + combined_name |
---|
[5755] | 103 | #combined_time_dir_name = topographies_time_dir + combined_name |
---|
| 104 | combined_smaller_name_dir = topographies_dir + combined_smaller_name |
---|
| 105 | #combined_time_dir_final_name = topographies_time_dir + combined_final_name |
---|
[5005] | 106 | |
---|
| 107 | meshes_dir = anuga_dir+'meshes'+sep |
---|
| 108 | meshes_dir_name = meshes_dir + scenario_name |
---|
| 109 | |
---|
| 110 | polygons_dir = anuga_dir+'polygons'+sep |
---|
| 111 | tide_dir = anuga_dir+'tide_data'+sep |
---|
| 112 | |
---|
| 113 | |
---|
[5755] | 114 | #boundaries_source = '1' |
---|
[5005] | 115 | |
---|
[5755] | 116 | if source=='polyline': |
---|
| 117 | boundaries_name = 'perth_3103_28052008' #polyline gun |
---|
| 118 | boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'polyline'+sep+'1_10000'+sep |
---|
[5005] | 119 | |
---|
[5755] | 120 | if source=='test': |
---|
| 121 | boundaries_name = 'other' #polyline |
---|
| 122 | boundaries_in_dir = anuga_dir+'boundaries'+sep |
---|
[5005] | 123 | |
---|
| 124 | |
---|
| 125 | #boundaries locations |
---|
[5755] | 126 | boundaries_in_dir_name = boundaries_in_dir + boundaries_name |
---|
[5005] | 127 | boundaries_dir = anuga_dir+'boundaries'+sep |
---|
[5755] | 128 | boundaries_dir_name = boundaries_dir + scenario_name # what it creates??? |
---|
| 129 | boundaries_dir_mux = muxhome |
---|
[5005] | 130 | |
---|
| 131 | #output locations |
---|
| 132 | output_dir = anuga_dir+'outputs'+sep |
---|
[5755] | 133 | output_build_time_dir = anuga_dir+'outputs'+sep+build_time+dir_comment+sep |
---|
| 134 | output_run_time_dir = anuga_dir+'outputs'+sep+run_time+dir_comment+sep |
---|
[5005] | 135 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
| 136 | |
---|
[5755] | 137 | vertex_filename = output_run_time_dir + 'mesh_vertex.csv' |
---|
| 138 | |
---|
[5005] | 139 | #gauges |
---|
[5755] | 140 | gauge_name = 'carnarvon.csv' |
---|
| 141 | |
---|
[5005] | 142 | gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep |
---|
[5755] | 143 | beach_gauges = gauges_dir + 'beach_gauges.csv' |
---|
[5005] | 144 | gauges_dir_name = gauges_dir + gauge_name |
---|
| 145 | |
---|
[5755] | 146 | ##buildings_filename = gauges_dir + 'Perth_resA.csv' |
---|
| 147 | ##buildings_filename_out = 'Perth_res_Project_modified.csv' |
---|
[5005] | 148 | |
---|
| 149 | ############################### |
---|
[5755] | 150 | # Interior region definitions |
---|
[5005] | 151 | ############################### |
---|
| 152 | |
---|
[5755] | 153 | #Initial bounding polygon for data clipping |
---|
[5005] | 154 | poly_all = read_polygon(polygons_dir+'poly_all.csv') |
---|
| 155 | res_poly_all = 100000*res_factor |
---|
| 156 | |
---|
[5755] | 157 | #Polygon designed |
---|
| 158 | poly_internal_20 = read_polygon(polygons_dir+'Carnarvon20m.csv') |
---|
| 159 | res_internal_20 = 25000*res_factor |
---|
[5005] | 160 | |
---|
[5755] | 161 | #Polygon designed to |
---|
| 162 | poly_internal_5 = read_polygon(polygons_dir+'Carnarvon5m.csv') |
---|
| 163 | res_internal_5 = 500*res_factor |
---|
[5005] | 164 | |
---|
[5755] | 165 | #Polygon designed to |
---|
| 166 | poly_internal_10 = read_polygon(polygons_dir+'Carnarvon10m.csv') |
---|
| 167 | res_internal_10 = 1500*res_factor |
---|
[5005] | 168 | |
---|
[5755] | 169 | #Polygon designed to incorporate |
---|
| 170 | poly_island_20 = read_polygon(polygons_dir+'Island20m.csv') |
---|
| 171 | res_island_20 = 50000*res_factor |
---|
[5005] | 172 | |
---|
| 173 | |
---|
[5755] | 174 | interior_regions = [[poly_internal_20,res_internal_20],[poly_internal_5,res_internal_5] |
---|
| 175 | ,[poly_island_20,res_island_20],[poly_internal_10,res_internal_10]] |
---|
[5005] | 176 | |
---|
[5755] | 177 | |
---|
[5005] | 178 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
[5755] | 179 | print 'min number triangles', trigs_min |
---|
| 180 | |
---|
[5005] | 181 | |
---|
[5755] | 182 | poly_mainland = read_polygon(polygons_dir+'initial_condition.csv') |
---|
[5005] | 183 | |
---|
[5755] | 184 | ################################################################### |
---|
| 185 | # Clipping regions for export to asc and regions for clipping data |
---|
| 186 | ################################################################### |
---|
[5005] | 187 | |
---|
| 188 | |
---|