[5205] | 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 |
---|
| 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 | #--------------------------------- |
---|
| 15 | #codename = 'project.py' |
---|
| 16 | |
---|
| 17 | home = getenv('INUNDATIONHOME') + sep +'data'+sep #Sandpit's parent diruser = get_user_name() |
---|
| 18 | user = get_user_name() |
---|
| 19 | host = get_host_name() |
---|
| 20 | |
---|
| 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 |
---|
| 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 | |
---|
| 30 | #Making assumptions about the location of scenario data |
---|
| 31 | state = 'sw_pacific' |
---|
| 32 | scenario_name = 'Kolonia_fixed_wave' |
---|
| 33 | scenario = 'FSM' |
---|
| 34 | |
---|
| 35 | tide =0 |
---|
| 36 | |
---|
| 37 | alpha = 0.1 |
---|
| 38 | friction=0.01 |
---|
| 39 | starttime=10000 |
---|
| 40 | midtime=21600 |
---|
| 41 | finaltime=10000 |
---|
| 42 | export_cellsize=50 |
---|
| 43 | setup='final' |
---|
| 44 | source='test' |
---|
| 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(scenario_name)+'_'+str(user) |
---|
| 63 | |
---|
| 64 | # onshore data 5m countour |
---|
| 65 | onshore_name = 'lidar_data_5m' # original' |
---|
| 66 | onshore_name1 = 'topo_25m' |
---|
| 67 | # AHO + DPI data + colin French coastline |
---|
| 68 | #coast_name = 'waterline' |
---|
| 69 | Multibeam_name = 'multibeam' |
---|
| 70 | added_data_name='sandedge' |
---|
| 71 | |
---|
| 72 | |
---|
| 73 | #final topo name |
---|
| 74 | combined_name ='Kolonia_combined_elevation' |
---|
| 75 | combined_smaller_name = 'Kolonia_combined_elevation_smaller' |
---|
| 76 | combined_name1 ='Kolonia_combined_elevation1' |
---|
| 77 | anuga_dir = home+state+sep+scenario+sep+'anuga'+sep |
---|
| 78 | |
---|
| 79 | topographies_in_dir = home+sep+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep |
---|
| 80 | topographies_dir = anuga_dir+'topographies'+sep |
---|
| 81 | #topographies_time_dir = topographies_dir+build_time+sep |
---|
| 82 | |
---|
| 83 | # input topo file location |
---|
| 84 | onshore_in_dir_name = topographies_in_dir + onshore_name |
---|
| 85 | onshore_in_dir_name1 = topographies_in_dir + onshore_name1 |
---|
| 86 | Multibeam_in_dir_name = topographies_in_dir + Multibeam_name |
---|
| 87 | added_data_in_dir_name = topographies_in_dir + added_data_name |
---|
| 88 | |
---|
| 89 | onshore_dir_name = topographies_dir + onshore_name |
---|
| 90 | onshore_dir_name1 = topographies_dir + onshore_name1 |
---|
| 91 | Multibeam_dir_name = topographies_dir + Multibeam_name |
---|
| 92 | added_data_dir_name = topographies_dir + added_data_name |
---|
| 93 | |
---|
| 94 | #final topo files |
---|
| 95 | combined_dir_name = topographies_dir + combined_name |
---|
| 96 | combined_dir_name1 = topographies_dir + combined_name1 |
---|
| 97 | #combined_time_dir_name = topographies_time_dir + combined_name |
---|
| 98 | combined_smaller_name_dir = topographies_dir + combined_smaller_name |
---|
| 99 | #combined_time_dir_final_name = topographies_time_dir + combined_final_name |
---|
| 100 | |
---|
| 101 | meshes_dir = anuga_dir+'meshes'+sep |
---|
| 102 | meshes_dir_name = meshes_dir + scenario_name |
---|
| 103 | |
---|
| 104 | polygons_dir = anuga_dir+'polygons'+sep |
---|
| 105 | tide_dir = anuga_dir+'tide_data'+sep |
---|
| 106 | |
---|
| 107 | |
---|
| 108 | #boundaries_source = '1' |
---|
| 109 | |
---|
| 110 | if source =='dampier': |
---|
| 111 | boundaries_name = 'broome_3854_17042007' #Dampier gun |
---|
| 112 | boundaries_in_dir = anuga_dir+'boundaries'+sep+sep+'dampier'+sep+'1_10000'+sep |
---|
| 113 | |
---|
| 114 | if source=='onslow': |
---|
| 115 | boundaries_name = 'broome_3859_16052007' #onslow_hedland_broome gun |
---|
| 116 | boundaries_in_dir = anuga_dir+'boundaries'+sep+sep+'onslow_hedland_broome'+sep+'1_10000'+sep |
---|
| 117 | |
---|
| 118 | if source=='exmouth': |
---|
| 119 | boundaries_name = 'broome_3103_18052007' #exmouth gun |
---|
| 120 | boundaries_in_dir = anuga_dir+'boundaries'+sep+sep+'exmouth'+sep+'1_10000'+sep |
---|
| 121 | |
---|
| 122 | if source=='test': |
---|
| 123 | boundaries_name = 'other' #exmouth gun |
---|
| 124 | boundaries_in_dir = anuga_dir+'boundaries'+sep |
---|
| 125 | |
---|
| 126 | |
---|
| 127 | #boundaries locations |
---|
| 128 | boundaries_in_dir_name = boundaries_in_dir + scenario_name |
---|
| 129 | boundaries_dir = anuga_dir+'boundaries'+sep |
---|
| 130 | boundaries_dir_name = boundaries_dir + scenario_name |
---|
| 131 | #boundaries_time_dir = anuga_dir+'boundaries'+sep+build_time+sep |
---|
| 132 | #boundaries_time_dir_name = boundaries_time_dir + boundaries_name #Used by post processing |
---|
| 133 | |
---|
| 134 | #output locations |
---|
| 135 | output_dir = anuga_dir+'outputs'+sep |
---|
| 136 | output_build_time_dir = anuga_dir+'outputs'+sep+build_time+dir_comment+sep |
---|
| 137 | output_run_time_dir = anuga_dir+'outputs'+sep+run_time+dir_comment+sep |
---|
| 138 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
| 139 | |
---|
| 140 | #gauges |
---|
| 141 | #gauge_name = 'perth.csv' |
---|
| 142 | #gauges_dir = anuga_dir+'gauges'+sep |
---|
| 143 | #gauges_dir_name = gauges_dir + gauge_name |
---|
| 144 | |
---|
| 145 | #buildings_filename = gauges_dir + 'Perth_res_Project.csv' |
---|
| 146 | #buildings_filename_out = 'Perth_res_Project_modified.csv' |
---|
| 147 | |
---|
| 148 | ############################### |
---|
| 149 | # Domain definitions |
---|
| 150 | ############################### |
---|
| 151 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon |
---|
| 152 | |
---|
| 153 | poly_all = read_polygon(polygons_dir+'extent.txt') |
---|
| 154 | res_poly_all = 5000*res_factor |
---|
| 155 | |
---|
| 156 | #refzone = 50 |
---|
| 157 | |
---|
| 158 | ############################### |
---|
| 159 | # Interior region definitions |
---|
| 160 | ############################### |
---|
| 161 | |
---|
| 162 | poly_west_reef = read_polygon(polygons_dir+'poly_lidar1.txt') |
---|
| 163 | poly_west = read_polygon(polygons_dir+'poly_lidar4.txt') |
---|
| 164 | poly_centerKolonia = read_polygon(polygons_dir+'poly_lidar2.txt') |
---|
| 165 | poly_east = read_polygon(polygons_dir+'poly_lidar3.txt') |
---|
| 166 | |
---|
| 167 | kolonia_res = 5000 |
---|
| 168 | fine_res = 100 |
---|
| 169 | |
---|
| 170 | interior_regions = [[poly_west_reef, kolonia_res], |
---|
| 171 | [poly_west,kolonia_res], |
---|
| 172 | [poly_centerKolonia,fine_res], |
---|
| 173 | [poly_east,kolonia_res]] |
---|
| 174 | |
---|
| 175 | |
---|
| 176 | boundary_tags={'lagoon_west':[0], |
---|
| 177 | 'Reef_edge':[1,2,3,4,5,6,7,8,9,10,11,12,13,14], |
---|
| 178 | 'East&land':[15,16,17], |
---|
| 179 | 'Land':[18,19]} |
---|
| 180 | |
---|
| 181 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
| 182 | |
---|
| 183 | print 'min number triangles', trigs_min |
---|
| 184 | ################################################################### |
---|
| 185 | # Clipping regions for export to asc and regions for clipping data |
---|
| 186 | ################################################################### |
---|
| 187 | |
---|
| 188 | # exporting asc grid |
---|
| 189 | eastingmin = 403481 |
---|
| 190 | eastingmax = 415706 |
---|
| 191 | northingmin = 766423 |
---|
| 192 | northingmax = 776418 |
---|
| 193 | |
---|
| 194 | |
---|
| 195 | |
---|
| 196 | |
---|
| 197 | |
---|