1 | # Convert ASC 2 DEM 2 PTS using source data and store result in source data |
---|
2 | # Do for coarse and fine data |
---|
3 | # Fine pts file to be clipped to area of interest |
---|
4 | #------------------------------------------------------------------------------- |
---|
5 | print"project.combined_dir_name",project.combined_dir_name |
---|
6 | |
---|
7 | # topography directory filenames |
---|
8 | onshore_dir_name = project.onshore_dir_name |
---|
9 | onshore_dir_name1 = project.onshore_dir_name |
---|
10 | #island_in_dir_name = project_urs.island_in_dir_name |
---|
11 | Multibeam_dir_name = project.Multibeam_dir_name |
---|
12 | added_data_dir_name =project.added_data_dir_name |
---|
13 | |
---|
14 | print'create Geospatial data1 objects from topographies',onshore_dir_name + '.txt' |
---|
15 | G1 = Geospatial_data(file_name = onshore_dir_name + '.txt') |
---|
16 | |
---|
17 | print'create Geospatial data1 objects from topographies',onshore_dir_name1 + '.txt' |
---|
18 | G2 = Geospatial_data(file_name = onshore_dir_name1 + '.txt') |
---|
19 | |
---|
20 | print'create Geospatial data2 objects from multibeam', Multibeam_dir_name + '.txt' |
---|
21 | G_off1 = Geospatial_data(file_name = Multibeam_dir_name + '.txt') |
---|
22 | |
---|
23 | print'create Geospatial data objects from added data',added_data_dir_name + '.txt' |
---|
24 | G_off2 = Geospatial_data(file_name = added_data_dir_name + '.txt') |
---|
25 | |
---|
26 | print'add all geospatial objects' |
---|
27 | Gt1 = G1.clip(Geospatial_data(project.poly_west_reef))+G1.clip(Geospatial_data(project.poly_west))+G1.clip(Geospatial_data(project.poly_centerKolonia))+G1.clip(Geospatial_data(project.poly_east)) |
---|
28 | Gt2= G2.clip_outside(Geospatial_data(project.poly_centerKolonia)).clip_outside(Geospatial_data(project.poly_east)) |
---|
29 | Gt3= G_off1.clip_outside(Geospatial_data(project.poly_west_reef)).clip_outside(Geospatial_data(project.poly_west)).clip_outside(Geospatial_data(project.poly_centerKolonia)).clip_outside(Geospatial_data(project.poly_east)) |
---|
30 | |
---|
31 | G=Gt1+Gt2+Gt3+G_off2 |
---|
32 | |
---|
33 | #print'clip combined geospatial object by bounding polygon' |
---|
34 | #G_clipped = G.clip(project_urs.poly_all) |
---|
35 | #FIXME: add a clip function to pts |
---|
36 | #print'shape of clipped data', G_clipped.get_data_points().shape |
---|
37 | |
---|
38 | print'export combined DEM file' |
---|
39 | if access(project.topographies_dir,F_OK) == 0: |
---|
40 | mkdir (project.topographies_dir) |
---|
41 | print'export',project.combined_dir_name+ '.txt' |
---|
42 | G.export_points_file(project.combined_dir_name+ '.txt') |
---|
43 | |
---|
44 | |
---|
45 | |
---|
46 | ''' |
---|
47 | print'project.combined_dir_name + 1.xya',project.combined_dir_name + '1.xya' |
---|
48 | G_all=Geospatial_data(file_name = project.combined_dir_name + '1.xya') |
---|
49 | print'split' |
---|
50 | G_all_1, G_all_2 = G_all.split(.10) |
---|
51 | print'export 1' |
---|
52 | G_all_1.export_points_file(project.combined_dir_name+'_small1' + '.xya') |
---|
53 | print'export 2' |
---|
54 | G_all_2.export_points_file(project.combined_dir_name+'_other1' + '.xya') |
---|
55 | |
---|
56 | |
---|
57 | #------------------------------------------------------------------------- |
---|
58 | # Convert URS to SWW file for boundary conditions |
---|
59 | #------------------------------------------------------------------------- |
---|
60 | print 'starting to create boundary conditions' |
---|
61 | boundaries_in_dir_name = project.boundaries_in_dir_name |
---|
62 | |
---|
63 | from anuga.shallow_water.data_manager import urs2sww |
---|
64 | |
---|
65 | print 'minlat=project.north_boundary, maxlat=project.south_boundary',project.north_boundary, project.south_boundary |
---|
66 | print 'minlon= project.west_boundary, maxlon=project.east_boundary',project.west_boundary, project.east_boundary |
---|
67 | |
---|
68 | #import sys; sys.exit() |
---|
69 | |
---|
70 | #if access(project.boundaries_dir,F_OK) == 0: |
---|
71 | # mkdir (project.boundaries_dir) |
---|
72 | |
---|
73 | from caching import cache |
---|
74 | cache(urs2sww, |
---|
75 | (boundaries_in_dir_name, |
---|
76 | project.boundaries_dir_name1), |
---|
77 | {'verbose': True, |
---|
78 | 'minlat': project.south_boundary, |
---|
79 | 'maxlat': project.north_boundary, |
---|
80 | 'minlon': project.west_boundary, |
---|
81 | 'maxlon': project.east_boundary, |
---|
82 | # 'minlat': project.south, |
---|
83 | # 'maxlat': project.north, |
---|
84 | # 'minlon': project.west, |
---|
85 | # 'maxlon': project.east, |
---|
86 | 'mint': 0, 'maxt': 40000, |
---|
87 | # 'origin': domain.geo_reference.get_origin(), |
---|
88 | 'mean_stage': project.tide, |
---|
89 | # 'zscale': 1, #Enhance tsunami |
---|
90 | 'fail_on_NaN': False}, |
---|
91 | verbose = True, |
---|
92 | ) |
---|
93 | # dependencies = source_dir + project.boundary_basename + '.sww') |
---|
94 | |
---|
95 | ''' |
---|
96 | |
---|
97 | |
---|
98 | |
---|
99 | |
---|
100 | |
---|
101 | |
---|
102 | |
---|
103 | |
---|