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_points, 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 | # better DEM |
---|
31 | gc5 = 'dem_5m_ascii' |
---|
32 | offshore = 'xy_AHD' |
---|
33 | coastline = 'coastline' |
---|
34 | |
---|
35 | #swollen/ all data output |
---|
36 | basename = 'source' |
---|
37 | codename = 'project.py' |
---|
38 | |
---|
39 | #Derive subdirectories and filenames |
---|
40 | local_time = strftime('%Y%m%d_%H%M%S',gmtime()) |
---|
41 | meshdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'meshes'+sep |
---|
42 | datadir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'topographies'+sep |
---|
43 | gaugedir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'gauges'+sep |
---|
44 | polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep |
---|
45 | boundarydir = home+sep+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'boundaries'+sep |
---|
46 | outputdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'outputs'+sep |
---|
47 | outputtimedir = outputdir + local_time + sep |
---|
48 | polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep |
---|
49 | alex_datadir = home+sep+state+sep+scenario_dir_name+sep+'elevation_final'+sep+'points'+sep |
---|
50 | |
---|
51 | codedir = getcwd()+sep |
---|
52 | codedirname = codedir + 'project.py' |
---|
53 | meshname = outputtimedir + 'mesh_' + basename |
---|
54 | |
---|
55 | # Necessary if using point datasets, rather than grid |
---|
56 | gc_dem_name = alex_datadir + gc5 |
---|
57 | offshore_name = datadir + offshore |
---|
58 | coast_name = datadir + coastline |
---|
59 | combined_dem_name = datadir + 'gc_elevation' |
---|
60 | |
---|
61 | gauge_name = gaugedir + 'gc_gauges.csv' |
---|
62 | buildings_filename = gaugedir + 'gc_nexis.csv' |
---|
63 | buildings_filename_out = 'gc_nexis_modified.csv' |
---|
64 | ############################### |
---|
65 | # Domain definitions |
---|
66 | ############################### |
---|
67 | |
---|
68 | # bounding polygon for study area |
---|
69 | polyAll = read_polygon(polygondir+'extentv2.csv') |
---|
70 | |
---|
71 | print 'Area of bounding polygon', polygon_area(polyAll)/1000000.0 |
---|
72 | |
---|
73 | ############################### |
---|
74 | # Interior region definitions |
---|
75 | ############################### |
---|
76 | |
---|
77 | # digitized polygons |
---|
78 | poly_int = read_polygon(polygondir+'surfers.csv') |
---|
79 | |
---|
80 | print 'Area of local polygon', polygon_area(poly_int)/1000000.0 |
---|
81 | |
---|
82 | poly_bathy = read_polygon(polygondir+'mainland_only.csv') |
---|
83 | |
---|
84 | ################################################################### |
---|
85 | # Clipping regions for export to asc and regions for clipping data |
---|
86 | ################################################################### |
---|
87 | |
---|
88 | # exporting asc grid |
---|
89 | eastingmin = 534300 |
---|
90 | eastingmax = 546775 |
---|
91 | northingmin = 6890000 |
---|
92 | northingmax = 6912925 |
---|