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, polygon_area, is_inside_polygon |
---|
10 | |
---|
11 | if sys.platform == 'win32': |
---|
12 | home = getenv('INUNDATIONHOME') |
---|
13 | user = getenv('USERPROFILE') |
---|
14 | |
---|
15 | else: |
---|
16 | home = getenv('INUNDATIONHOME', sep+'d'+sep+'xrd'+sep+'gem'+sep+'2'+sep+'ramp'+sep+'risk_assessment_methods_project'+sep+'inundation') |
---|
17 | user = getenv('LOGNAME') |
---|
18 | print 'USER:', user |
---|
19 | |
---|
20 | # INUNDATIONHOME is the inundation directory, not the data directory. |
---|
21 | home += sep +'data' |
---|
22 | |
---|
23 | #Making assumptions about the location of scenario data |
---|
24 | state = 'tasmania' |
---|
25 | scenario_dir_name = 'smf_scenario_2008' |
---|
26 | |
---|
27 | # onshore data sourced from 250m grid |
---|
28 | onshore_name250 = 'bathyland250' |
---|
29 | |
---|
30 | # coastline from GA |
---|
31 | coast_line_name = 'aus_cst' |
---|
32 | |
---|
33 | # survey data |
---|
34 | offshore_name1 = 'S_Tasman_Rise_150m_EN_Interp' |
---|
35 | offshore_name2 = 'Sorell_Basin_150m_EN_Interp' |
---|
36 | offshore_name3 = 'West_Tas_EastNorth_z' |
---|
37 | |
---|
38 | #swollen/ all data output |
---|
39 | basename = 'source' |
---|
40 | codename = 'project_slide.py' |
---|
41 | |
---|
42 | #Derive subdirectories and filenames |
---|
43 | local_time = strftime('%Y%m%d_%H%M%S',gmtime()) |
---|
44 | meshdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'meshes'+sep |
---|
45 | datadir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'topographies'+sep |
---|
46 | gaugedir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'gauges'+sep |
---|
47 | polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep |
---|
48 | boundarydir = home+sep+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'boundaries'+sep |
---|
49 | outputdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'outputs'+sep |
---|
50 | outputtimedir = outputdir + local_time + sep |
---|
51 | polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep |
---|
52 | |
---|
53 | gauge_filename = gaugedir + 'west_tas_gauges.csv' |
---|
54 | codedir = getcwd()+sep |
---|
55 | codedirname = codedir + 'project_smf.py' |
---|
56 | meshname = outputtimedir + 'mesh_' + basename |
---|
57 | |
---|
58 | # Necessary if using point datasets, rather than grid |
---|
59 | onshore_250_dem_name = datadir + onshore_name250 |
---|
60 | offshore_dem_name1 = datadir + offshore_name1 |
---|
61 | offshore_dem_name2 = datadir + offshore_name2 |
---|
62 | offshore_dem_name3 = datadir + offshore_name3 |
---|
63 | coast_line = datadir + coast_line_name |
---|
64 | |
---|
65 | combined_dem_name = datadir + 'west_tas_combined_elevation' |
---|
66 | |
---|
67 | ############################### |
---|
68 | # Domain definitions |
---|
69 | ############################### |
---|
70 | |
---|
71 | # bounding polygon for study area |
---|
72 | polyAll = read_polygon(polygondir+'domain.csv') |
---|
73 | |
---|
74 | print 'Area of bounding polygon', polygon_area(polyAll)/1000000.0 |
---|
75 | |
---|
76 | ############################### |
---|
77 | # Interior region definitions |
---|
78 | ############################### |
---|
79 | |
---|
80 | # sydney digitized polygons |
---|
81 | poly_local = read_polygon(polygondir+'local.csv') |
---|
82 | poly_region = read_polygon(polygondir+'region.csv') |
---|
83 | |
---|
84 | print 'Area of region polygon', polygon_area(poly_region)/1000000.0 |
---|
85 | print 'Area of coastal polygon', polygon_area(poly_local)/1000000.0 |
---|
86 | |
---|
87 | ################################################################### |
---|
88 | # Clipping regions for export to asc and regions for clipping data |
---|
89 | ################################################################### |
---|
90 | |
---|
91 | # exporting asc grid |
---|
92 | eastingmin = 333000 |
---|
93 | eastingmax = 354000 |
---|
94 | northingmin = 6244800 |
---|
95 | northingmax = 6274550 |
---|
96 | |
---|
97 | |
---|
98 | ################################################################### |
---|
99 | # Slide characteristics |
---|
100 | ################################################################### |
---|
101 | |
---|
102 | # historical slides |
---|
103 | slide_origin = [338270.5407, 5217273.89] |
---|
104 | |
---|
105 | depth = 1750.0 |
---|
106 | length = 25000.0 |
---|
107 | thickness = 400.0 |
---|
108 | width = 50000.0 |
---|
109 | density = 1.46 |
---|
110 | slope = 4.0 |
---|
111 | alpha = 126.0 - 90.0 |
---|
112 | |
---|