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 = 'queensland' |
---|
25 | scenario_dir_name = 'gold_coast_hypothetical' |
---|
26 | |
---|
27 | # 250K product |
---|
28 | gc250 = 'dem_250' |
---|
29 | |
---|
30 | #swollen/ all data output |
---|
31 | basename = 'source' |
---|
32 | codename = 'project.py' |
---|
33 | |
---|
34 | #Derive subdirectories and filenames |
---|
35 | local_time = strftime('%Y%m%d_%H%M%S',gmtime()) |
---|
36 | meshdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'meshes'+sep |
---|
37 | datadir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'topographies'+sep |
---|
38 | gaugedir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'gauges'+sep |
---|
39 | polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep |
---|
40 | boundarydir = home+sep+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'boundaries'+sep |
---|
41 | outputdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'outputs'+sep |
---|
42 | outputtimedir = outputdir + local_time + sep |
---|
43 | polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep |
---|
44 | |
---|
45 | #gauge_filename = gaugedir + 'sydney_slide_gauges.csv' |
---|
46 | codedir = getcwd()+sep |
---|
47 | codedirname = codedir + 'project.py' |
---|
48 | meshname = outputtimedir + 'mesh_' + basename |
---|
49 | |
---|
50 | # Necessary if using point datasets, rather than grid |
---|
51 | gc_dem_name = datadir + gc250 |
---|
52 | combined_dem_name = datadir + 'gc_elevation' |
---|
53 | |
---|
54 | ############################### |
---|
55 | # Domain definitions |
---|
56 | ############################### |
---|
57 | |
---|
58 | # bounding polygon for study area |
---|
59 | polyAll = read_polygon(polygondir+'extent.csv') |
---|
60 | |
---|
61 | print 'Area of bounding polygon', polygon_area(polyAll)/1000000.0 |
---|
62 | |
---|
63 | ############################### |
---|
64 | # Interior region definitions |
---|
65 | ############################### |
---|
66 | |
---|
67 | # digitized polygons |
---|
68 | poly_int = read_polygon(polygondir+'surfers.csv') |
---|
69 | |
---|
70 | print 'Area of local polygon', polygon_area(poly_int)/1000000.0 |
---|
71 | |
---|
72 | ################################################################### |
---|
73 | # Clipping regions for export to asc and regions for clipping data |
---|
74 | ################################################################### |
---|
75 | |
---|
76 | # exporting asc grid |
---|
77 | eastingmin = 538450 |
---|
78 | eastingmax = 546775 |
---|
79 | northingmin = 6890540 |
---|
80 | northingmax = 6902925 |
---|