1 | |
---|
2 | import os, sys |
---|
3 | sys.path.append('..') |
---|
4 | |
---|
5 | from mesh import * |
---|
6 | from coordinate_transforms.geo_reference import Geo_reference |
---|
7 | |
---|
8 | #------------------------------------------------------------- |
---|
9 | if __name__ == "__main__": |
---|
10 | |
---|
11 | |
---|
12 | bellambi_northing = 6195000.0 |
---|
13 | north_beach_northing = 6183000.0 |
---|
14 | north_beach_easting = 308500 |
---|
15 | border = 12000.0 |
---|
16 | west = 301000.0 # From the map |
---|
17 | inner_east = 310000.0 # From the map |
---|
18 | inner_west_south = 303000.0 # From the map |
---|
19 | inner_west_north = 307000.0 # From the map |
---|
20 | east = 328421.0 |
---|
21 | sea_boundary = (east+inner_east)/2 |
---|
22 | inner_center_easting = ( inner_east +inner_west_north)/2 |
---|
23 | inner_center_northing = (bellambi_northing + north_beach_northing)/2 |
---|
24 | |
---|
25 | # from 100m dem |
---|
26 | geo = Geo_reference(xllcorner = inner_center_easting, |
---|
27 | yllcorner = inner_center_northing, |
---|
28 | zone = 56) |
---|
29 | print "***********************" |
---|
30 | print "geo ref", geo |
---|
31 | print "***********************" |
---|
32 | |
---|
33 | m = Mesh(geo_reference=geo) |
---|
34 | |
---|
35 | dict = {} |
---|
36 | dict['points'] = [[west, north_beach_northing - border], #sw |
---|
37 | [west, bellambi_northing + border], #nw |
---|
38 | [sea_boundary, |
---|
39 | bellambi_northing + border], #n_sea_boundary |
---|
40 | [east, bellambi_northing + border], #ne |
---|
41 | [east, north_beach_northing - border], #se |
---|
42 | [sea_boundary, |
---|
43 | north_beach_northing - border] #s_sea_boundary |
---|
44 | ] |
---|
45 | dict['segments'] = [[0,1],[1,2],[2,3], |
---|
46 | [3,4],[4,5],[5,0], # the outer boarder |
---|
47 | [2,5] # the sea_boundary line |
---|
48 | ] |
---|
49 | |
---|
50 | m.addVertsSegs(dict) |
---|
51 | |
---|
52 | dict = {} |
---|
53 | dict['points'] = [ |
---|
54 | [inner_west_south,north_beach_northing], #sw |
---|
55 | [inner_west_north,bellambi_northing], #nw |
---|
56 | [inner_east,bellambi_northing], #ne |
---|
57 | [inner_east,north_beach_northing] #se |
---|
58 | ] |
---|
59 | dict['segments'] = [[0,1],[1,2],[2,3],[3,0]] # the inner boarder |
---|
60 | m.addVertsSegs(dict) |
---|
61 | |
---|
62 | #Even more inner points |
---|
63 | flagstaff_x = 308000 |
---|
64 | flagstaff_y = 6189000 |
---|
65 | west_x = 305000 |
---|
66 | west_y = 6185000 |
---|
67 | |
---|
68 | north_beach_northing = 6183000.0 |
---|
69 | |
---|
70 | dict = {} |
---|
71 | dict['points'] = [ |
---|
72 | [flagstaff_x,flagstaff_y], #n |
---|
73 | [west_x,west_y], #w |
---|
74 | [north_beach_easting,north_beach_northing], #s |
---|
75 | ] |
---|
76 | dict['segments'] = [[0,1],[1,2],[2,0]] # the inner boarder |
---|
77 | m.addVertsSegs(dict) |
---|
78 | |
---|
79 | factor = 1000 #low res 10000, high res 1000 |
---|
80 | low = m.addRegionEN(east-0.5, bellambi_northing + border-0.5) |
---|
81 | low.setMaxArea(100*factor) |
---|
82 | |
---|
83 | medium = m.addRegionEN(sea_boundary-0.5, bellambi_northing + border-0.5) |
---|
84 | medium.setMaxArea(10*factor) |
---|
85 | |
---|
86 | high = m.addRegionEN(inner_east-0.5,bellambi_northing-0.5) |
---|
87 | high.setMaxArea(5*factor) #doing 0.5, fac = 1000 gives degenerate error |
---|
88 | |
---|
89 | center = m.addRegionEN(flagstaff_x,flagstaff_y-0.5) |
---|
90 | center.setMaxArea(0.05*factor) #doing 0.5, fac = 1000 gives degenerate error |
---|
91 | #m.generateMesh() |
---|
92 | m.generateMesh("pzq28.0za1000000a") |
---|
93 | |
---|
94 | m.export_mesh_file("wollongong_4regions.msh") |
---|
95 | #m.export_mesh_file("wollongong_highres_a28.tsh") |
---|
96 | |
---|