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, \ |
---|
10 | polygon_area, is_inside_polygon |
---|
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+\ |
---|
18 | '2'+sep+'ramp'+sep+'risk_assessment_methods_project'+\ |
---|
19 | sep+'inundation') |
---|
20 | user = getenv('LOGNAME') |
---|
21 | print 'USER:', user |
---|
22 | |
---|
23 | # INUNDATIONHOME is the inundation directory, not the data directory. |
---|
24 | home += sep +'data' |
---|
25 | |
---|
26 | #Making assumptions about the location of scenario data |
---|
27 | state = 'queensland' |
---|
28 | scenario_dir_name = 'cairns_tsunami_scenario_demo' |
---|
29 | |
---|
30 | # onshore data provided by WA DLI |
---|
31 | demname = 'cairns' |
---|
32 | |
---|
33 | #swollen/ all data output |
---|
34 | basename = 'source' |
---|
35 | codename = 'project.py' |
---|
36 | |
---|
37 | #Derive subdirectories and filenames |
---|
38 | local_time = strftime('%Y%m%d_%H%M%S',gmtime()) |
---|
39 | meshdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'meshes'+sep |
---|
40 | datadir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'topographies'+sep |
---|
41 | gaugedir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'gauges'+sep |
---|
42 | polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep |
---|
43 | boundarydir = home+sep+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'boundaries'+sep |
---|
44 | outputdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'outputs'+sep |
---|
45 | outputtimedir = outputdir + local_time + sep |
---|
46 | polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep |
---|
47 | |
---|
48 | gauge_filename = gaugedir + 'gauges.csv' |
---|
49 | codedir = getcwd()+sep |
---|
50 | codedirname = codedir + 'project.py' |
---|
51 | #meshname = outputtimedir + 'mesh_' + basename |
---|
52 | |
---|
53 | # Necessary if using point datasets, rather than grid |
---|
54 | dem_name = datadir + demname |
---|
55 | |
---|
56 | ############################### |
---|
57 | # Domain definitions |
---|
58 | ############################### |
---|
59 | |
---|
60 | # bounding polygon for study area |
---|
61 | polyAll = read_polygon(polygondir+'extent_v2.csv') |
---|
62 | |
---|
63 | print 'Area of bounding polygon', polygon_area(polyAll)/1000000.0 |
---|
64 | |
---|
65 | ################################################################### |
---|
66 | # Clipping regions for export to asc and regions for clipping data |
---|
67 | ################################################################### |
---|
68 | |
---|
69 | # exporting asc grid |
---|
70 | eastingmin = 356300 |
---|
71 | eastingmax = 398500 |
---|
72 | northingmin = 8107850 |
---|
73 | northingmax = 8148700 |
---|
74 | |
---|
75 | ############################### |
---|
76 | # Interior region definitions |
---|
77 | ############################### |
---|
78 | |
---|
79 | # broome digitized polygons |
---|
80 | poly_cairns = read_polygon(polygondir+'cairns.csv') |
---|
81 | poly_island0 = read_polygon(polygondir+'islands.csv') |
---|
82 | poly_island1 = read_polygon(polygondir+'islands1.csv') |
---|
83 | poly_island2 = read_polygon(polygondir+'islands2.csv') |
---|
84 | poly_island3 = read_polygon(polygondir+'islands3.csv') |
---|
85 | poly_shallow = read_polygon(polygondir+'shallow.csv') |
---|
86 | |
---|
87 | plot_polygons([polyAll,poly_cairns,poly_island0,poly_island1,\ |
---|
88 | poly_island2,poly_island3,poly_shallow],\ |
---|
89 | 'boundingpoly',verbose=False) |
---|
90 | |
---|
91 | #slump_origin = [633361, 8129700] |
---|
92 | #slump_depth = 986 |
---|
93 | slump_origin = [451871, 8128376] # move onto the continental shelf, depth = 500 |
---|
94 | slump_depth = 500. |
---|