[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 | #--------------------------------- |
---|
| 15 | |
---|
| 16 | home = getenv('INUNDATIONHOME') + sep +'data'+sep #Sandpit's parent dir |
---|
| 17 | user = get_user_name() |
---|
| 18 | host = get_host_name() |
---|
| 19 | # INUNDATIONHOME is the inundation directory, not the data directory. |
---|
| 20 | |
---|
| 21 | #needed when running using mpirun, mpirun doesn't inherit umask from .bashrc |
---|
| 22 | umask(002) |
---|
| 23 | |
---|
| 24 | #time stuff |
---|
| 25 | time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir |
---|
| 26 | build_time = time+'_build' |
---|
| 27 | run_time = time+'_run' |
---|
| 28 | |
---|
| 29 | tide = 0.6 |
---|
| 30 | |
---|
| 31 | #Making assumptions about the location of scenario data |
---|
| 32 | state = 'western_australia' |
---|
| 33 | scenario_name = 'busselton' |
---|
[5149] | 34 | scenario = 'busselton_tsunami_scenario' |
---|
[5000] | 35 | |
---|
| 36 | #Maybe will try to make project a class to allow these parameters to be passed in. |
---|
| 37 | alpha = 0.1 |
---|
| 38 | friction=0.01 |
---|
[5408] | 39 | starttime=0 |
---|
[5000] | 40 | midtime=21600 |
---|
[5149] | 41 | #finaltime=25000 |
---|
[5408] | 42 | finaltime=86000 |
---|
| 43 | export_cellsize=25 |
---|
[5387] | 44 | setup='final' |
---|
| 45 | source='exmouth' |
---|
[5000] | 46 | |
---|
| 47 | |
---|
| 48 | if setup =='trial': |
---|
| 49 | print'trial' |
---|
| 50 | res_factor=10 |
---|
| 51 | time_thinning=48 |
---|
| 52 | yieldstep=240 |
---|
| 53 | if setup =='basic': |
---|
| 54 | print'basic' |
---|
| 55 | res_factor=4 |
---|
| 56 | time_thinning=12 |
---|
| 57 | yieldstep=120 |
---|
| 58 | if setup =='final': |
---|
| 59 | print'final' |
---|
| 60 | res_factor=1 |
---|
| 61 | time_thinning=4 |
---|
| 62 | yieldstep=60 |
---|
| 63 | |
---|
| 64 | dir_comment='_'+setup+'_'+str(tide)+'_'+str(source)+'_'+str(user) |
---|
| 65 | |
---|
| 66 | |
---|
| 67 | # onshore data provided by WA DLI |
---|
[5149] | 68 | #onshore_name = 'DLI_orthophoto_DEM' # original |
---|
| 69 | onshore_name = 'dli_dem_clipped' # original |
---|
[5000] | 70 | #islands |
---|
| 71 | |
---|
| 72 | # AHO + DPI data |
---|
[5149] | 73 | coast_name = 'coastline_excluding_beach_survey' |
---|
[5381] | 74 | coast_name1 = 'bussleton_beach_data' |
---|
| 75 | offshore_name = 'Busselton_bathymetry' |
---|
[5000] | 76 | |
---|
| 77 | #final topo name |
---|
[5149] | 78 | combined_name ='busselton_combined_elevation' |
---|
| 79 | combined_name_small = 'busselton_combined_elevation_smaller' |
---|
[5000] | 80 | |
---|
| 81 | anuga_dir = home+state+sep+scenario+sep+'anuga'+sep |
---|
| 82 | |
---|
[5149] | 83 | topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep |
---|
| 84 | topographies_dir = home+state+sep+scenario+sep+'anuga'+sep+'topographies'+sep |
---|
[5000] | 85 | |
---|
[5381] | 86 | # input topo file location |
---|
| 87 | onshore_in_dir_name = topographies_in_dir + onshore_name #topo |
---|
[5000] | 88 | |
---|
[5381] | 89 | coast_in_dir_name = topographies_in_dir + coast_name #coastline |
---|
| 90 | coast_in_dir_name1 = topographies_in_dir + coast_name1 #beach survey |
---|
| 91 | offshore_in_dir_name = topographies_in_dir + offshore_name #bathymetry |
---|
[5000] | 92 | |
---|
[5381] | 93 | #output to anuga from build file |
---|
[5000] | 94 | onshore_dir_name = topographies_dir + onshore_name |
---|
[5381] | 95 | |
---|
[5000] | 96 | coast_dir_name = topographies_dir + coast_name |
---|
[5149] | 97 | coast_dir_name1 = topographies_dir + coast_name1 |
---|
[5000] | 98 | offshore_dir_name = topographies_dir + offshore_name |
---|
| 99 | |
---|
| 100 | #final topo files |
---|
| 101 | combined_dir_name = topographies_dir + combined_name |
---|
[5149] | 102 | combined_dir_name_small = topographies_dir + combined_name_small |
---|
[5000] | 103 | |
---|
| 104 | meshes_dir = anuga_dir+'meshes'+sep |
---|
| 105 | meshes_dir_name = meshes_dir + scenario_name |
---|
| 106 | |
---|
| 107 | polygons_dir = anuga_dir+'polygons'+sep |
---|
| 108 | tide_dir = anuga_dir+'tide_data'+sep |
---|
| 109 | |
---|
| 110 | if source=='exmouth': |
---|
[5387] | 111 | boundaries_name = 'busselton_3103_30052008' #exmouth gun |
---|
[5000] | 112 | boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'exmouth'+sep+'1_10000'+sep |
---|
| 113 | |
---|
[5387] | 114 | if source=='test': |
---|
| 115 | boundaries_name = 'other' #exmouth gun |
---|
[5000] | 116 | boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'exmouth'+sep+'1_10000'+sep |
---|
| 117 | |
---|
| 118 | |
---|
| 119 | #boundaries locations |
---|
| 120 | boundaries_in_dir_name = boundaries_in_dir + boundaries_name |
---|
| 121 | boundaries_dir = anuga_dir+'boundaries'+sep |
---|
| 122 | boundaries_dir_name = boundaries_dir + scenario_name |
---|
| 123 | |
---|
| 124 | #output locations |
---|
| 125 | output_dir = anuga_dir+'outputs'+sep |
---|
[5121] | 126 | output_build_time_dir = output_dir+build_time+dir_comment+sep |
---|
[5000] | 127 | #output_run_time_dir = output_dir +run_time+dir_comment+sep |
---|
[5121] | 128 | output_run_time_dir = anuga_dir+sep+'outputs'+sep+run_time+dir_comment+sep |
---|
[5000] | 129 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
| 130 | |
---|
| 131 | #gauges |
---|
| 132 | gauge_name = '???.csv' |
---|
[5149] | 133 | gauges_dir = home+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep |
---|
[5000] | 134 | gauges_dir_name = gauges_dir + gauge_name |
---|
| 135 | |
---|
| 136 | buildings_filename = gauges_dir + 'Busselton_res_Project.csv' |
---|
| 137 | buildings_filename_out = 'Busselton_res_Project_modified.csv' |
---|
| 138 | |
---|
| 139 | community_filename = gauges_dir +'' |
---|
| 140 | community_broome = gauges_dir + '' |
---|
| 141 | |
---|
| 142 | |
---|
| 143 | ############################### |
---|
| 144 | # Domain definitions |
---|
| 145 | ############################### |
---|
| 146 | |
---|
| 147 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon |
---|
| 148 | |
---|
| 149 | # bounding polygon for study area |
---|
| 150 | poly_all = read_polygon(polygons_dir+'poly_all.csv') |
---|
| 151 | res_poly_all = 100000*res_factor |
---|
| 152 | |
---|
| 153 | ################################################################### |
---|
| 154 | # Clipping regions for export to asc and regions for clipping data |
---|
| 155 | ################################################################### |
---|
| 156 | |
---|
| 157 | # exporting asc grid |
---|
| 158 | eastingmin = 340000 |
---|
| 159 | eastingmax = 350000 |
---|
| 160 | northingmin = 6273400 |
---|
| 161 | northingmax = 6277700 |
---|
| 162 | |
---|
| 163 | ############################### |
---|
| 164 | # Interior region definitions |
---|
| 165 | ############################### |
---|
| 166 | |
---|
| 167 | #digitized polygons |
---|
| 168 | poly_busselton1 = read_polygon(polygons_dir+'neg20_pos10_polygon.csv') |
---|
| 169 | res_busselton1 = 10000*res_factor |
---|
[5149] | 170 | |
---|
[5381] | 171 | poly_busselton2 = read_polygon(polygons_dir+'neg5_pos5_poly.csv') |
---|
[5000] | 172 | res_busselton2 = 500*res_factor |
---|
| 173 | |
---|
| 174 | #plot_polygons([polyAll,poly_broome1,poly_broome2,poly_broome3],figname='boundingpoly2',verbose=False) |
---|
| 175 | |
---|
| 176 | interior_regions = [[poly_busselton1,res_busselton1],[poly_busselton2,res_busselton2]] |
---|
[5381] | 177 | print 'Hello',interior_regions |
---|
[5000] | 178 | |
---|
[5381] | 179 | boundary_tags={'back': [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 14], |
---|
| 180 | 'side': [10], 'ocean': [11, 12, 13]} |
---|
[5000] | 181 | |
---|
| 182 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
| 183 | |
---|
[5387] | 184 | poly_mainland=read_polygon(polygons_dir+'initial_condition.csv') |
---|
[5000] | 185 | |
---|
| 186 | print 'min number triangles', trigs_min |
---|
| 187 | |
---|
| 188 | |
---|