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 provided by NSW LPI, Krishna merged with existing |
---|
28 | # PMD data to make 100m DEM |
---|
29 | on_offshore_name100 = 'bathyland100' |
---|
30 | |
---|
31 | # survey data |
---|
32 | offshore_name1 = 'surveyAreaA' |
---|
33 | offshore_name2 = 'surveyAreaB' |
---|
34 | offshore_name3 = 'surveyAreaC' |
---|
35 | |
---|
36 | # AHO data |
---|
37 | offshore_name4 = '1000003611export' |
---|
38 | offshore_name5 = '1000003613export' |
---|
39 | offshore_name6 = '1000003614export' |
---|
40 | offshore_name7 = '1000003627export' |
---|
41 | offshore_name8 = '1000003628export' |
---|
42 | offshore_name9 = 'AHDexport' |
---|
43 | ''' |
---|
44 | #swollen/ all data output |
---|
45 | basename = 'source' |
---|
46 | codename = 'project_slide.py' |
---|
47 | |
---|
48 | #Derive subdirectories and filenames |
---|
49 | local_time = strftime('%Y%m%d_%H%M%S',gmtime()) |
---|
50 | meshdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'meshes'+sep |
---|
51 | datadir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'topographies'+sep |
---|
52 | gaugedir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'gauges'+sep |
---|
53 | polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep |
---|
54 | boundarydir = home+sep+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'boundaries'+sep |
---|
55 | outputdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'outputs'+sep |
---|
56 | outputtimedir = outputdir + local_time + sep |
---|
57 | polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep |
---|
58 | |
---|
59 | gauge_filename = gaugedir + 'west_tas_gauges.csv' |
---|
60 | codedir = getcwd()+sep |
---|
61 | codedirname = codedir + 'project_smf.py' |
---|
62 | meshname = outputtimedir + 'mesh_' + basename |
---|
63 | ''' |
---|
64 | # Necessary if using point datasets, rather than grid |
---|
65 | on_offshore100_dem_name = datadir + on_offshore_name100 |
---|
66 | offshore_dem_name1 = datadir + offshore_name1 |
---|
67 | offshore_dem_name2 = datadir + offshore_name2 |
---|
68 | offshore_dem_name3 = datadir + offshore_name3 |
---|
69 | |
---|
70 | combined_dem_name = datadir + 'west_tas_combined_elevation' |
---|
71 | ''' |
---|
72 | ############################### |
---|
73 | # Domain definitions |
---|
74 | ############################### |
---|
75 | |
---|
76 | # bounding polygon for study area |
---|
77 | polyAll = read_polygon(polygondir+'domain.csv') |
---|
78 | |
---|
79 | print 'Area of bounding polygon', polygon_area(polyAll)/1000000.0 |
---|
80 | |
---|
81 | ############################### |
---|
82 | # Interior region definitions |
---|
83 | ############################### |
---|
84 | |
---|
85 | # sydney digitized polygons |
---|
86 | poly_local = read_polygon(polygondir+'local.csv') |
---|
87 | poly_region = read_polygon(polygondir+'region.csv') |
---|
88 | |
---|
89 | print 'Area of region polygon', polygon_area(poly_region)/1000000.0 |
---|
90 | print 'Area of coastal polygon', polygon_area(poly_local)/1000000.0 |
---|
91 | |
---|
92 | ################################################################### |
---|
93 | # Clipping regions for export to asc and regions for clipping data |
---|
94 | ################################################################### |
---|
95 | |
---|
96 | |
---|
97 | # exporting asc grid |
---|
98 | eastingmin = 333000 |
---|
99 | eastingmax = 354000 |
---|
100 | northingmin = 6244800 |
---|
101 | northingmax = 6274550 |
---|
102 | |
---|
103 | |
---|
104 | ################################################################### |
---|
105 | # Slide characteristics |
---|
106 | ################################################################### |
---|
107 | |
---|
108 | # historical slides |
---|
109 | #slide_origin = [,] |
---|
110 | |
---|
111 | depth = 1750.0 |
---|
112 | length = 25000.0 |
---|
113 | thickness = 400.0 |
---|
114 | width = 50000.0 |
---|
115 | density = 1.46 |
---|
116 | slope = 4.0 |
---|
117 | alpha = 126.0 - 90.0 |
---|
118 | |
---|