source: anuga_work/production/FSM/test_clip @ 7254

Last change on this file since 7254 was 5205, checked in by herve, 17 years ago
File size: 4.1 KB
Line 
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#-------------------------------------------------------------------------------
5print"project.combined_dir_name",project.combined_dir_name
6
7# topography directory filenames
8onshore_dir_name = project.onshore_dir_name
9onshore_dir_name1 = project.onshore_dir_name
10#island_in_dir_name = project_urs.island_in_dir_name
11Multibeam_dir_name = project.Multibeam_dir_name
12added_data_dir_name =project.added_data_dir_name
13
14print'create Geospatial data1 objects from topographies',onshore_dir_name + '.txt'
15G1 = Geospatial_data(file_name = onshore_dir_name + '.txt')
16
17print'create Geospatial data1 objects from topographies',onshore_dir_name1 + '.txt'
18G2 = Geospatial_data(file_name = onshore_dir_name1 + '.txt')
19
20print'create Geospatial data2 objects from multibeam', Multibeam_dir_name + '.txt'
21G_off1 = Geospatial_data(file_name = Multibeam_dir_name + '.txt')
22
23print'create Geospatial data objects from added data',added_data_dir_name + '.txt'
24G_off2 = Geospatial_data(file_name = added_data_dir_name + '.txt')
25
26print'add all geospatial objects'
27Gt1 = 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))
28Gt2= G2.clip_outside(Geospatial_data(project.poly_centerKolonia)).clip_outside(Geospatial_data(project.poly_east))
29Gt3= 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                         
31G=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
38print'export combined DEM file'
39if access(project.topographies_dir,F_OK) == 0:
40    mkdir (project.topographies_dir)
41print'export',project.combined_dir_name+ '.txt'
42G.export_points_file(project.combined_dir_name+ '.txt')
43
44
45
46'''
47print'project.combined_dir_name + 1.xya',project.combined_dir_name + '1.xya'
48G_all=Geospatial_data(file_name = project.combined_dir_name + '1.xya')
49print'split'
50G_all_1, G_all_2 = G_all.split(.10)
51print'export 1'
52G_all_1.export_points_file(project.combined_dir_name+'_small1' + '.xya')
53print'export 2'
54G_all_2.export_points_file(project.combined_dir_name+'_other1' + '.xya')
55
56
57#-------------------------------------------------------------------------
58# Convert URS to SWW file for boundary conditions
59#-------------------------------------------------------------------------
60print 'starting to create boundary conditions'
61boundaries_in_dir_name = project.boundaries_in_dir_name
62
63from anuga.shallow_water.data_manager import urs2sww
64
65print 'minlat=project.north_boundary, maxlat=project.south_boundary',project.north_boundary, project.south_boundary
66print '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
73from caching import cache
74cache(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
Note: See TracBrowser for help on using the repository browser.