1 | """ Make a line of gauges from outside boundary to near centre polygon |
---|
2 | for Onslow study to look at MOST wave and compare to ANUGA output |
---|
3 | """ |
---|
4 | import project |
---|
5 | from pylab import plot, xlabel, ylabel, title, ion, axis, savefig, close |
---|
6 | from utilities.polygon import poly_xy |
---|
7 | from Numeric import arange |
---|
8 | |
---|
9 | x_bound, y_bound = poly_xy(project.polyAll) |
---|
10 | |
---|
11 | # nominated point in centre region for Onslow |
---|
12 | x2 = 305000.0 |
---|
13 | y2 = 7605000.0 |
---|
14 | |
---|
15 | d0 = project.d0 |
---|
16 | d1 = project.d1 |
---|
17 | d2 = project.d2 |
---|
18 | d3 = project.d3 |
---|
19 | |
---|
20 | d = [d0, d1, d2, d3] |
---|
21 | ion() |
---|
22 | fid = open(project.gauge_comparison,'w') |
---|
23 | s = 'Easting,Northing,Name \n' |
---|
24 | fid.write(s) |
---|
25 | count = 0 |
---|
26 | for i, point in enumerate(d): |
---|
27 | x = point[0] |
---|
28 | y = point[1] |
---|
29 | m = (y-y2)/(x-x2) |
---|
30 | c = y2-m*x2 |
---|
31 | if m > 0: |
---|
32 | plotx = arange(240000,340000,1000.0) |
---|
33 | for j, xpoint in enumerate(plotx): |
---|
34 | name = 'Point%d' %count |
---|
35 | count += 1 |
---|
36 | s = '%.2f,%.2f,%s \n' %(xpoint,m*xpoint+c,name) |
---|
37 | fid.write(s) |
---|
38 | else: |
---|
39 | plotx = arange(240000,340000,5000.0) |
---|
40 | for j, xpoint in enumerate(plotx): |
---|
41 | name = 'Point%d' %count |
---|
42 | count += 1 |
---|
43 | s = '%.2f,%.2f,%s \n' %(xpoint,m*xpoint+c,name) |
---|
44 | fid.write(s) |
---|
45 | plot(x_bound, y_bound, plotx,m*plotx+c,'+') |
---|
46 | |
---|
47 | axis([240000,340000, 7580000, 7800000]) |
---|
48 | savefig('boundarycomparison') |
---|
49 | close('all') |
---|