[2616] | 1 | """Common filenames and locations for topographic data, meshes and outputs. |
---|
| 2 | Also includes origin for slump scenario. |
---|
| 3 | """ |
---|
| 4 | |
---|
[3249] | 5 | from os import sep, environ, getenv, getcwd |
---|
[2616] | 6 | from os.path import expanduser |
---|
[3788] | 7 | from anuga.utilities.polygon import read_polygon, polygon_area |
---|
[2616] | 8 | import sys |
---|
| 9 | |
---|
[3769] | 10 | from anuga.coordinate_transforms.redfearn import convert_from_latlon_to_utm |
---|
[2616] | 11 | |
---|
[3535] | 12 | from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees |
---|
[2616] | 13 | |
---|
[3249] | 14 | from time import localtime, strftime, gmtime |
---|
[2616] | 15 | |
---|
| 16 | #Making assumptions about the location of scenario data |
---|
[3270] | 17 | state = 'western_australia' |
---|
[2616] | 18 | scenario_dir_name = 'onslow_tsunami_scenario_2006' |
---|
[4151] | 19 | scenario_name = 'onslow' |
---|
[2616] | 20 | |
---|
| 21 | # 250m data to be provided |
---|
| 22 | coarsename = 'onsl_bathydem250' # get from Neil/Ingo (DEM or topo data) |
---|
| 23 | |
---|
| 24 | # 30m data to be provided |
---|
[3261] | 25 | onshore_name_dted = 'onslow_onshore_30m_dted2' # get from Neil/Ingo (DEM or topo data) |
---|
[2616] | 26 | |
---|
[3261] | 27 | # 20m data to be provided |
---|
| 28 | onshore_name_dli = 'onslow_onshore_20m_dli' # get from Neil/Ingo (DEM or topo data) |
---|
| 29 | |
---|
| 30 | coast_name = 'onslow_coast' |
---|
| 31 | islands_name = 'onslow_islands_dted2' |
---|
[2616] | 32 | offshore_name = 'onslow_offshore_points' |
---|
| 33 | |
---|
[2645] | 34 | boundary_basename = 'SU-AU_clip' |
---|
[2616] | 35 | |
---|
| 36 | #swollen/ all data output |
---|
| 37 | basename = 'source' |
---|
| 38 | |
---|
| 39 | codename = 'project.py' |
---|
| 40 | |
---|
| 41 | if sys.platform == 'win32': |
---|
[3249] | 42 | home = getenv('INUNDATIONHOME') |
---|
| 43 | # python_home = getenv('PWD') |
---|
| 44 | # home = environ['INUNDATIONHOME'] #Sandpit's parent dir |
---|
| 45 | user = getenv('USERPROFILE') |
---|
| 46 | # user = basename(user_path) |
---|
| 47 | |
---|
[2616] | 48 | else: |
---|
[3249] | 49 | home = getenv('INUNDATIONHOME', sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'risk_assessment_methods_project'+sep+'inundation') |
---|
| 50 | user = getenv('LOGNAME') |
---|
| 51 | print 'USER:', user |
---|
[2616] | 52 | |
---|
[3669] | 53 | # INUNDATIONHOME is the inundation directory, not the data directory. |
---|
| 54 | home += sep +'data' |
---|
| 55 | |
---|
[2616] | 56 | #Derive subdirectories and filenames |
---|
[3249] | 57 | #time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir |
---|
| 58 | local_time = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir |
---|
| 59 | |
---|
[3270] | 60 | meshdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'meshes'+sep |
---|
| 61 | datadir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'topographies'+sep |
---|
| 62 | gaugedir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'gauges'+sep |
---|
| 63 | polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep |
---|
| 64 | boundarydir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'boundaries'+sep |
---|
[2682] | 65 | #output dir without time |
---|
[3270] | 66 | outputdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'outputs'+sep |
---|
| 67 | tidedir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'tide_data'+sep |
---|
[3276] | 68 | comparereportdir = '..'+sep+'..'+sep+'documentation'+sep+'experimentation'+sep+'boundary_ANUGA_MOST'+sep+'report' |
---|
[3249] | 69 | |
---|
| 70 | outputtimedir = outputdir + local_time + sep |
---|
| 71 | |
---|
[2624] | 72 | print'bound', boundarydir |
---|
[2616] | 73 | |
---|
[2773] | 74 | #gauge_filename = gaugedir + 'onslow_gauges.xya' |
---|
| 75 | #for MOST |
---|
[2958] | 76 | gauge_filename = gaugedir + 'gauge_location_onslow.csv' |
---|
[4134] | 77 | gauge_filename_bindi = gaugedir + 'gauge_location_bindi.csv' |
---|
[3136] | 78 | gauges50 = gaugedir + '50_gauges.xya' |
---|
[3158] | 79 | gauge_comparison = gaugedir + 'MOST_comparison_gauges.xya' |
---|
[3188] | 80 | gauge_comparison_3d = gaugedir + 'MOST_comparison_gauges_3d.xya' |
---|
[3136] | 81 | community_filename = gaugedir + 'CHINS_v2.csv' |
---|
| 82 | community_scenario = gaugedir + 'community_onslow.csv' |
---|
[3391] | 83 | #buildings_filename = gaugedir + 'onslow_res.csv' |
---|
| 84 | buildings_filename = gaugedir + 'extra_points_nbed.csv' |
---|
| 85 | #buildings_filename_out = gaugedir + 'onslow_res_modified.csv' |
---|
[3396] | 86 | buildings_filename_damage_out = 'extra_points_nbed_modified.csv' |
---|
[3136] | 87 | |
---|
[2682] | 88 | gaugetimeseries = gaugedir + 'onslow' |
---|
| 89 | |
---|
[2721] | 90 | tidal_filename = tidedir + 'onsl.txt' |
---|
| 91 | tidal_outname = tidedir + 'max_min.txt' |
---|
| 92 | |
---|
[2624] | 93 | # boundary source data |
---|
[2645] | 94 | #MOST_dir = 'f:'+sep+'3'+sep+'ehn'+sep+'users'+sep+'davidb'+sep+'tsunami'+sep+'WA_project'+sep+'SU-AU_90'+sep+'most_2'+sep+'detailed'+sep |
---|
[2624] | 95 | |
---|
[2616] | 96 | codedir = getcwd()+sep |
---|
| 97 | |
---|
| 98 | codedirname = codedir + 'project.py' |
---|
| 99 | |
---|
[3249] | 100 | #meshname = meshdir + basename |
---|
| 101 | meshname = outputtimedir + 'mesh_' + basename |
---|
| 102 | print 'meshname',meshname |
---|
[2616] | 103 | coarsedemname = datadir + coarsename |
---|
| 104 | |
---|
[3261] | 105 | onshore_dem_name = datadir + onshore_name_dli |
---|
[2616] | 106 | |
---|
| 107 | offshore_dem_name = datadir + offshore_name |
---|
[3261] | 108 | coast_dem_name = datadir + coast_name |
---|
| 109 | islands_dem_name = datadir + islands_name |
---|
[2616] | 110 | combined_dem_name = datadir + 'onslow_combined_elevation' |
---|
| 111 | |
---|
[2682] | 112 | outputname = outputtimedir + basename #Used by post processing |
---|
[2616] | 113 | |
---|
| 114 | #!gauge_filename = outputdir + 'onslow_gauges.xya' |
---|
| 115 | #!gauge_outname = outputdir + 'gauges_max_output.xya' |
---|
| 116 | |
---|
[2682] | 117 | # clipping region to make DEM (pts file) from fine elevation data |
---|
| 118 | eastingmin = 240000 |
---|
| 119 | eastingmax = 340000 |
---|
[2616] | 120 | northingmin = 7580000 |
---|
[2682] | 121 | northingmax = 7700000 |
---|
[2616] | 122 | |
---|
[2773] | 123 | south = degminsec2decimal_degrees(-22,15,0) |
---|
[2683] | 124 | north = degminsec2decimal_degrees(-20,30,0) |
---|
[2773] | 125 | west = degminsec2decimal_degrees(114,15,0) |
---|
[2683] | 126 | east = degminsec2decimal_degrees(115,50,0) |
---|
[2682] | 127 | ''' |
---|
[2616] | 128 | # region for visualisation |
---|
| 129 | eminviz = 260000 |
---|
| 130 | emaxviz = 320000 |
---|
| 131 | nminviz = 7590000 |
---|
| 132 | nmaxviz = 7630000 |
---|
[2682] | 133 | ''' |
---|
| 134 | # region to export |
---|
[2616] | 135 | |
---|
[2773] | 136 | e_min_area = 300000 |
---|
[2682] | 137 | e_max_area = 310000 |
---|
[2773] | 138 | n_min_area = 7600000 |
---|
| 139 | n_max_area = 7610000 |
---|
[2682] | 140 | |
---|
[3669] | 141 | # region to export to make elevation map: JS 22/9/06 - NOTE, this won't |
---|
| 142 | # work as region needs to be inside bounding box (polyAll)!! |
---|
[3650] | 143 | |
---|
| 144 | e_min_area = 240000 |
---|
| 145 | e_max_area = 340000 |
---|
| 146 | n_min_area = 7580000 |
---|
| 147 | n_max_area = 7690000 |
---|
[3669] | 148 | export_region = [[e_min_area, n_min_area], |
---|
| 149 | [e_min_area, n_max_area], |
---|
| 150 | [e_max_area, n_max_area], |
---|
| 151 | [e_max_area, n_min_area]] |
---|
[2616] | 152 | #Georeferencing |
---|
[3535] | 153 | from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees |
---|
[2616] | 154 | |
---|
| 155 | refzone = 50 |
---|
| 156 | |
---|
[2682] | 157 | #Updated Main Domain of Onslow: first run NB 6/4/06 |
---|
| 158 | d0 = [310000, 7690000] |
---|
| 159 | d1 = [280000, 7690000] |
---|
| 160 | d2 = [270000, 7645000] |
---|
| 161 | d3 = [240000, 7625000] |
---|
| 162 | d4 = [270000, 7580000] |
---|
| 163 | d5 = [300000, 7590000] |
---|
| 164 | d6 = [340000, 7610000] |
---|
[2616] | 165 | |
---|
[2645] | 166 | polyAll = [d0, d1, d2, d3, d4, d5, d6] |
---|
[3788] | 167 | print 'bounding polygon area', polygon_area(polyAll)/1000000.0 |
---|
[3669] | 168 | polygons = [polyAll, export_region] |
---|
| 169 | figname = 'checking.png' |
---|
[4063] | 170 | #from anuga.utilities.polygon import plot_polygons |
---|
| 171 | #plot_polygons(polygons, figname, verbose = False) |
---|
| 172 | #print figname |
---|
[2616] | 173 | #Interior region - Onslow town |
---|
| 174 | |
---|
[3249] | 175 | #first run! |
---|
[2773] | 176 | #i0 = [304000, 7608000] |
---|
[3249] | 177 | #i1 = [302000, 7605000] |
---|
[2773] | 178 | #i2 = [303000, 7602000] |
---|
[3249] | 179 | #i3 = [305000, 7601000] |
---|
| 180 | #i4 = [309000, 7603000] |
---|
| 181 | #i5 = [307000, 7606500] |
---|
| 182 | |
---|
| 183 | #refined run |
---|
| 184 | #i0 = [304000, 7607000] |
---|
| 185 | #i1 = [302000, 7605000] |
---|
| 186 | #i2 = [304000, 7603000] |
---|
| 187 | #i3 = [307000, 7602000] |
---|
| 188 | #i4 = [309000, 7603000] |
---|
| 189 | #i5 = [307000, 7606000] |
---|
| 190 | |
---|
| 191 | #for visualisation |
---|
[3265] | 192 | #i0 = [304000, 7609000] |
---|
| 193 | #i1 = [301500, 7605000] |
---|
| 194 | #i2 = [304000, 7603000] |
---|
| 195 | #i3 = [307000, 7602000] |
---|
| 196 | #i4 = [309000, 7603000] |
---|
| 197 | #i5 = [311000, 7607000] |
---|
| 198 | |
---|
| 199 | #i0 = [304000, 7608000] |
---|
| 200 | i0 = [304000, 7607000] |
---|
| 201 | i1 = [302000, 7605000] |
---|
| 202 | #i2 = [303000, 7602000] |
---|
[2773] | 203 | i2 = [304000, 7603000] |
---|
[3265] | 204 | #i3 = [305000, 7601000] |
---|
[2773] | 205 | i3 = [307000, 7602000] |
---|
[2616] | 206 | i4 = [309000, 7603000] |
---|
[3265] | 207 | #i5 = [307000, 7606500] |
---|
| 208 | i5 = [307000, 7606000] |
---|
[2616] | 209 | |
---|
[3249] | 210 | |
---|
[2616] | 211 | poly_onslow = [i0, i1, i2, i3, i4, i5] |
---|
[3788] | 212 | print 'onslow polygon area', polygon_area(poly_onslow)/1000000.0 |
---|
[2616] | 213 | #Thevenard Island |
---|
| 214 | j0 = [294000, 7629000] |
---|
| 215 | j1 = [285000, 7625000] |
---|
| 216 | j2 = [294000, 7621000] |
---|
| 217 | j3 = [299000, 7625000] |
---|
| 218 | |
---|
| 219 | poly_thevenard = [j0, j1, j2, j3] |
---|
[3788] | 220 | print 'thevenard polygon area', polygon_area(poly_thevenard)/1000000.0 |
---|
[2773] | 221 | ''' |
---|
[2616] | 222 | # Direction Is |
---|
| 223 | k0 = [309000, 7619000] |
---|
| 224 | k1 = [304000, 7619000] |
---|
| 225 | k2 = [304000, 7616500] |
---|
| 226 | k3 = [309000, 7616500] |
---|
| 227 | |
---|
| 228 | poly_direction = [k0, k1, k2, k3] |
---|
[2682] | 229 | ''' |
---|
[2773] | 230 | |
---|
| 231 | #med res around onslow |
---|
| 232 | l0 = [300000, 7610000] |
---|
| 233 | l1 = [285000, 7600000] |
---|
| 234 | l2 = [300000, 7597500] |
---|
| 235 | l3 = [310000, 7600000] |
---|
| 236 | l4 = [315000, 7610000] |
---|
| 237 | #l5 = [310000, 7612500] |
---|
| 238 | |
---|
| 239 | #poly_coast = [l0, l1, l2, l3, l4, l5] |
---|
| 240 | poly_coast = [l0, l1, l2, l3, l4] |
---|
[3788] | 241 | print 'coast polygon area', polygon_area(poly_coast)/1000000.0 |
---|
[2773] | 242 | #general coast and local area to onslow region |
---|
| 243 | m0 = [270000, 7581000] |
---|
| 244 | m1 = [300000, 7591000] |
---|
| 245 | m2 = [339000, 7610000] |
---|
| 246 | m3 = [330000, 7630000] |
---|
| 247 | m4 = [290000, 7640000] |
---|
| 248 | m5 = [260000, 7600000] |
---|
| 249 | |
---|
| 250 | poly_region = [m0, m1, m2, m3, m4, m5] |
---|
[3788] | 251 | print 'region polygon area', polygon_area(poly_region)/1000000.0 |
---|