[3559] | 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 |
---|
[4856] | 9 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area |
---|
[3779] | 10 | from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees, convert_from_latlon_to_utm |
---|
[3671] | 11 | |
---|
| 12 | if sys.platform == 'win32': |
---|
| 13 | home = getenv('INUNDATIONHOME') |
---|
| 14 | user = getenv('USERPROFILE') |
---|
| 15 | |
---|
| 16 | else: |
---|
| 17 | home = getenv('INUNDATIONHOME', sep+'d'+sep+'xrd'+sep+'gem'+sep+'2'+sep+'ramp'+sep+'risk_assessment_methods_project'+sep+'inundation') |
---|
| 18 | user = getenv('LOGNAME') |
---|
| 19 | print 'USER:', user |
---|
| 20 | |
---|
| 21 | # INUNDATIONHOME is the inundation directory, not the data directory. |
---|
| 22 | home += sep +'data' |
---|
| 23 | |
---|
[3559] | 24 | #Making assumptions about the location of scenario data |
---|
| 25 | state = 'tasmania' |
---|
| 26 | scenario_dir_name = 'hobart_tsunami_scenario_2006' |
---|
| 27 | |
---|
[3721] | 28 | # data provided by Tas SES and checked by NM&I |
---|
| 29 | #onshore_name = 'hob3_topo' # original |
---|
| 30 | onshore_name_25 = 'hob5_topo_25m' # 25m grid and clipped to 100m elevation or 3000m from coast |
---|
| 31 | onshore_name = 'hob5_topo' # 12.5m grid and clipped to 100m elevation or 3000m from coast |
---|
| 32 | #onshore_name_25 = 'hob6_topo_25m' # 25m grid NOT clipped |
---|
| 33 | offshore_name_tas1 = 'derwent_2m' |
---|
| 34 | offshore_name_tas2 = 'derwent_5m' |
---|
| 35 | offshore_name_tas3 = 'south_east_tas' #actually this is AHO |
---|
| 36 | offshore_name_tas4 = 'hobart_1m' |
---|
[3559] | 37 | |
---|
[3721] | 38 | # AHO data and checked by NM&I |
---|
| 39 | offshore_name1 = 'xy100003760' |
---|
| 40 | offshore_name2 = 'xy100003761' |
---|
| 41 | offshore_name3 = 'xy100003762' |
---|
| 42 | offshore_name4 = 'xy100003907' |
---|
| 43 | offshore_name5 = 'xy100003908' |
---|
| 44 | offshore_name6 = 'xy100003909' |
---|
| 45 | offshore_name7 = 'xy100003910' |
---|
| 46 | offshore_name8 = 'xy100003932' |
---|
| 47 | offshore_name9 = 'xy100003933' |
---|
| 48 | offshore_name10 = 'xy100003934' |
---|
| 49 | offshore_name11 = 'xy100003935' |
---|
| 50 | offshore_name12 = 'xy100003936' |
---|
| 51 | offshore_name13 = 'xy100003964' |
---|
| 52 | offshore_name14 = 'xy100014250' |
---|
| 53 | offshore_name15 = 'xy100014253' |
---|
| 54 | offshore_name16 = 'xy100016142' |
---|
[3626] | 55 | |
---|
[3721] | 56 | # developed by NM&I |
---|
| 57 | coast_name = 'coastline_points' |
---|
[3559] | 58 | |
---|
[3779] | 59 | boundary_basename = 'puysegur' # Mw 8.7 |
---|
| 60 | #boundary_basename = 'puysegur_clip' # Mw 8.5 |
---|
[3559] | 61 | |
---|
| 62 | #swollen/ all data output |
---|
| 63 | basename = 'source' |
---|
| 64 | |
---|
| 65 | codename = 'project.py' |
---|
| 66 | |
---|
| 67 | #Derive subdirectories and filenames |
---|
| 68 | #time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir |
---|
| 69 | local_time = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir |
---|
| 70 | meshdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'meshes'+sep |
---|
| 71 | datadir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'topographies'+sep |
---|
| 72 | gaugedir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'gauges'+sep |
---|
| 73 | polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep |
---|
[3669] | 74 | boundarydir = home+sep+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'boundaries'+sep |
---|
[3559] | 75 | outputdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'outputs'+sep |
---|
| 76 | outputtimedir = outputdir + local_time + sep |
---|
| 77 | polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep |
---|
| 78 | |
---|
[3779] | 79 | #gauge_filename = gaugedir + 'hobart_gauges_final.csv' |
---|
[3867] | 80 | #gauge_filename = gaugedir + 'hobartGauges20061019.csv' |
---|
[4030] | 81 | #gauge_filename = gaugedir + 'riskAreas231106.csv' |
---|
| 82 | gauge_filename = gaugedir + 'hobart_gauges2.csv' |
---|
[4275] | 83 | gauge_filename = gaugedir + 'gauges_MRT.csv' |
---|
[4029] | 84 | #gauge_filename_bom = gaugedir + 'gauges_bruny_fine.csv' |
---|
[3852] | 85 | #gauge_filename = gaugedir + 'check_boundary.csv' |
---|
[3559] | 86 | |
---|
[3671] | 87 | codedir = getcwd()+sep |
---|
[3559] | 88 | codedirname = codedir + 'project.py' |
---|
| 89 | meshname = outputtimedir + 'mesh_' + basename |
---|
| 90 | |
---|
[3701] | 91 | # Necessary if using point datasets, rather than grid |
---|
[3721] | 92 | onshore_dem_name = datadir + onshore_name |
---|
| 93 | onshore_dem_name_25 = datadir + onshore_name_25 |
---|
| 94 | all_onshore_dem_name = datadir + 'combined_onshore' |
---|
| 95 | offshore_dem_name_local1 = datadir + offshore_name_tas1 |
---|
| 96 | offshore_dem_name_local2 = datadir + offshore_name_tas2 |
---|
| 97 | offshore_dem_name_local3 = datadir + offshore_name_tas3 |
---|
| 98 | offshore_dem_name_local4 = datadir + offshore_name_tas4 |
---|
| 99 | offshore_dem_name_aho1 = datadir + offshore_name1 |
---|
| 100 | offshore_dem_name_aho2 = datadir + offshore_name2 |
---|
| 101 | offshore_dem_name_aho3 = datadir + offshore_name3 |
---|
| 102 | offshore_dem_name_aho4 = datadir + offshore_name4 |
---|
| 103 | offshore_dem_name_aho5 = datadir + offshore_name5 |
---|
| 104 | offshore_dem_name_aho6 = datadir + offshore_name6 |
---|
| 105 | offshore_dem_name_aho7 = datadir + offshore_name7 |
---|
| 106 | offshore_dem_name_aho8 = datadir + offshore_name8 |
---|
| 107 | offshore_dem_name_aho9 = datadir + offshore_name9 |
---|
| 108 | offshore_dem_name_aho10 = datadir + offshore_name10 |
---|
| 109 | offshore_dem_name_aho11 = datadir + offshore_name11 |
---|
| 110 | offshore_dem_name_aho12 = datadir + offshore_name12 |
---|
| 111 | offshore_dem_name_aho13 = datadir + offshore_name13 |
---|
| 112 | offshore_dem_name_aho14 = datadir + offshore_name14 |
---|
| 113 | offshore_dem_name_aho15 = datadir + offshore_name15 |
---|
| 114 | offshore_dem_name_aho16 = datadir + offshore_name16 |
---|
| 115 | coast_dem_name = datadir + coast_name |
---|
[3701] | 116 | |
---|
[3671] | 117 | # addition once total grid delivered |
---|
[3683] | 118 | onshore_offshore_dem_name_25 = datadir + '25m_se_tas' #25m grid |
---|
[3701] | 119 | onshore_offshore_dem_name = datadir + '50m_se_tas' #50m grid |
---|
| 120 | |
---|
[3683] | 121 | # output names |
---|
[3701] | 122 | bruny_dem_name_25 = datadir + 'bruny_25_dem' |
---|
| 123 | hobart_dem_name_25 = datadir + 'hobart_25_dem' |
---|
| 124 | combined_dem_name = datadir + 'hobart_combined_elevation' |
---|
[3683] | 125 | combined_dem_name_2 = datadir + 'hobart_combined_elevation_2' |
---|
[3721] | 126 | combined_dem_name_3 = datadir + 'hobart_combined_elevation_jane' |
---|
| 127 | combined_dem_name_4 = datadir + 'hobart_combined_elevation_test' |
---|
[3559] | 128 | |
---|
[3701] | 129 | #outputname = outputtimedir + basename #Used by post processing |
---|
[3559] | 130 | |
---|
[3671] | 131 | ############################### |
---|
| 132 | # Domain definitions |
---|
| 133 | ############################### |
---|
[3650] | 134 | |
---|
[3701] | 135 | # bounding box for clipping MOST output (much bigger than study area) |
---|
[3679] | 136 | south = degminsec2decimal_degrees(-44,45,0) |
---|
| 137 | north = degminsec2decimal_degrees(-42,0,0) |
---|
[3701] | 138 | west = degminsec2decimal_degrees(146,45,0) |
---|
| 139 | east = degminsec2decimal_degrees(148,25,0) |
---|
[3559] | 140 | |
---|
[3701] | 141 | ###Main Domain of Hobart: |
---|
[3615] | 142 | d0 = [south, west] |
---|
| 143 | d1 = [south, east] |
---|
| 144 | d2 = [north, east] |
---|
| 145 | d3 = [north, west] |
---|
[3769] | 146 | polyAll2, zone = convert_from_latlon_to_utm([d0, d1, d2, d3]) |
---|
[3559] | 147 | refzone = zone |
---|
| 148 | |
---|
[3679] | 149 | # Mark run - morning Fri 29 Sep; surrounds -100m and 20mish elevation |
---|
[3721] | 150 | polyAll = read_polygon(polygondir+'new_extent_2.csv') |
---|
[4856] | 151 | #plot_polygons([polyAll, polyAll2],figname='boundingpoly',verbose=False) |
---|
[3809] | 152 | #print 'Area of bounding polygon', polygon_area(polyAll) |
---|
[3779] | 153 | polyAll_refine = read_polygon(polygondir+'extent_refine.csv') |
---|
[3809] | 154 | #print 'Area of refined bounding polygon', polygon_area(polyAll_refine) |
---|
| 155 | #print 'change', polygon_area(polyAll_refine)/polygon_area(polyAll) |
---|
[3671] | 156 | |
---|
[3779] | 157 | polyAll_refine2 = read_polygon(polygondir+'export_refine_2.csv') |
---|
[3809] | 158 | #print 'Area of refined bounding polygon 2', polygon_area(polyAll_refine2) |
---|
| 159 | #print 'change 2', polygon_area(polyAll_refine2)/polygon_area(polyAll) |
---|
[3779] | 160 | |
---|
[3671] | 161 | ################################################################### |
---|
| 162 | # Clipping regions for export to asc and regions for clipping data |
---|
| 163 | ################################################################### |
---|
| 164 | |
---|
[3721] | 165 | # clipping 12.5m onshore data set |
---|
| 166 | eastingmin = 520000 |
---|
| 167 | eastingmax = 536000 |
---|
| 168 | northingmin = 5245000 |
---|
| 169 | northingmax = 5260000 |
---|
[3809] | 170 | # for original model setup |
---|
[3683] | 171 | # clipping 25m data set - Hobart |
---|
[3701] | 172 | eastingmin25 = 524208.387 |
---|
| 173 | eastingmax25 = 554867.24 |
---|
[3683] | 174 | northingmin25 = 5229154.555 |
---|
| 175 | northingmax25 = 5258511.857 |
---|
[3779] | 176 | hob_clip = [[eastingmin25,northingmin25],[eastingmin25,northingmax25],[eastingmax25,northingmax25],[eastingmax25,northingmin25]] |
---|
[3683] | 177 | # clipping 25m data set - Bruny |
---|
| 178 | eastingmin25_2 = 523672.502 |
---|
| 179 | eastingmax25_2 = 536020.057 |
---|
| 180 | northingmin25_2 = 5203120.035 |
---|
| 181 | northingmax25_2 = 5212052.309 |
---|
[3779] | 182 | bruny_clip = [[eastingmin25_2,northingmin25_2],[eastingmin25_2,northingmax25_2],[eastingmax25_2,northingmax25_2],[eastingmax25_2,northingmin25_2]] |
---|
[3732] | 183 | # overall 25m clipping region - covering Hobart and Bruny |
---|
| 184 | eastingmin25_3 = 523672.502 |
---|
| 185 | eastingmax25_3 = 554867.24 |
---|
| 186 | northingmin25_3 = 5203120.035 |
---|
| 187 | northingmax25_3 = 5258511.857 |
---|
| 188 | |
---|
[3809] | 189 | # export for refined grids at paleo sites |
---|
| 190 | eastingmin_site13 = 532835.94 |
---|
| 191 | eastingmax_site13 = 533848.23 |
---|
| 192 | northingmin_site13 = 5237384.18 |
---|
| 193 | northingmax_site13 = 5238195.03 |
---|
| 194 | |
---|
[3886] | 195 | eastingmin_kingston = 525500 #525905.49 |
---|
[3981] | 196 | eastingmax_kingston = 525680 |
---|
| 197 | northingmin_kingston = 5240850 |
---|
| 198 | northingmax_kingston = 5242060 #5242148.58 |
---|
[3809] | 199 | |
---|
| 200 | eastingmin_bruny = 523638.9 |
---|
| 201 | eastingmax_bruny = 533000.88 |
---|
| 202 | northingmin_bruny = 5204967.41 |
---|
| 203 | northingmax_bruny = 5212177.69 |
---|
| 204 | |
---|
[3671] | 205 | ############################### |
---|
| 206 | # Interior region definitions |
---|
| 207 | ############################### |
---|
| 208 | |
---|
[3679] | 209 | # Hobart digitized polygons |
---|
| 210 | poly_hobart1 = read_polygon(polygondir+'Hob_poly1.csv') |
---|
| 211 | poly_hobart2 = read_polygon(polygondir+'Hob_poly2.csv') |
---|
| 212 | poly_hobart3 = read_polygon(polygondir+'Hob_poly3.csv') |
---|
[3721] | 213 | poly_hobart4 = read_polygon(polygondir+'Hob_poly4.csv') |
---|
[3795] | 214 | poly_hobart5 = read_polygon(polygondir+'new_interior_region.csv') |
---|
[3559] | 215 | |
---|
[3972] | 216 | #plot_polygons([polyAll, poly_hobart1,poly_hobart2,poly_hobart3,poly_hobart5],'orig_model',verbose=False) |
---|
[3779] | 217 | |
---|
[3809] | 218 | # to refine around paleo sites |
---|
[3981] | 219 | poly_kingston = read_polygon(polygondir+'Kingston_up.csv') |
---|
[3809] | 220 | poly_bruny = read_polygon(polygondir+'bruny_refine.csv') |
---|
| 221 | poly_site13 = read_polygon(polygondir+'Site13.csv') |
---|
[3852] | 222 | #print 'areas of refined polys', polygon_area(poly_kingston), polygon_area(poly_bruny), polygon_area(poly_site13) |
---|
[3809] | 223 | |
---|
[3972] | 224 | #plot_polygons([polyAll, poly_kingston,poly_bruny,poly_site13,poly_hobart5],'orig_model',verbose=False) |
---|
[3809] | 225 | #print 'Area of interior regions', (polygon_area(poly_hobart1)+\ |
---|
| 226 | # polygon_area(poly_hobart2)+polygon_area(poly_hobart3)+\ |
---|
| 227 | # polygon_area(poly_hobart4)+polygon_area(poly_hobart5))/1000000. |
---|
| 228 | |
---|
| 229 | #print 'Area of original 25m data clipping', (polygon_area(hob_clip)+polygon_area(bruny_clip))/1000000. |
---|
| 230 | #print 'Area of new interior region', polygon_area(poly_hobart5)/1000000. |
---|