source: production/onslow_2006/make_gauges.py @ 3171

Last change on this file since 3171 was 3169, checked in by sexton, 19 years ago

updates to Onslow report

File size: 3.0 KB
RevLine 
[3158]1""" Make a line of gauges from outside boundary to near centre polygon
2for Onslow study to look at MOST wave and compare to ANUGA output
3"""
4import project
[3169]5from pylab import plot, xlabel, ylabel, title, ion, axis, savefig, close, text
[3158]6from utilities.polygon import poly_xy
7from Numeric import arange
[3159]8from pmesh.create_mesh import convert_points_from_latlon_to_utm
[3158]9
10x_bound, y_bound = poly_xy(project.polyAll)
11
[3159]12MOST_south = project.south
13MOST_north = project.north
14MOST_east = project.east
15MOST_west = project.west
16p0 = [MOST_south, MOST_west]
17p1 = [MOST_south, MOST_east]
18p2 = [MOST_north, MOST_east]
19p3 = [MOST_north, MOST_west]
20MOSTpoly, zone = convert_points_from_latlon_to_utm([p0, p1, p2, p3])
21
22MOSTymax = 0
23MOSTymin = 7800000.0
24MOSTxmax = 0
25MOSTxmin = 7800000.0
26for i, point in enumerate(MOSTpoly):
27    x = point[0]
28    y = point[1]
29    if y > MOSTymax: MOSTymax = y
30    if y < MOSTymin: MOSTymin = y
31    if x > MOSTxmax: MOSTxmax = x
32    if x < MOSTxmin: MOSTxmin = x
33
34MOSTymax = MOSTymax-3000.0
35print 'MOST clipping: ', MOSTxmin, MOSTxmax, MOSTymin, MOSTymax
[3158]36# nominated point in centre region for Onslow
37x2 = 305000.0
38y2 = 7605000.0
[3159]39testy = 7625000.0
[3158]40
41d0 = project.d0
42d1 = project.d1
43d2 = project.d2
44d3 = project.d3
45
46d = [d0, d1, d2, d3]
47ion()
48fid = open(project.gauge_comparison,'w')
[3159]49s = 'Easting,Northing,Name,Elevation \n'
[3158]50fid.write(s)
51count = 0
[3159]52miny = 7580000.0
53maxy = 7800000.0
54xplot = []
55yplot = []
[3169]56names = []
[3158]57for i, point in enumerate(d):
58    x = point[0]
59    y = point[1]
60    m = (y-y2)/(x-x2)
61    c = y2-m*x2
62    if m > 0:
[3159]63        plotx = arange(MOSTxmin,MOSTxmax,1000.0)
[3158]64        for j, xpoint in enumerate(plotx):
[3159]65            ypoint = m*xpoint+c
66            if ypoint > testy and ypoint <= d0[1]:
67            #if ypoint >= testy and ypoint <= MOSTymax:
68                if xpoint > MOSTxmin and xpoint < MOSTxmax:
69                    xplot.append(xpoint)
70                    yplot.append(ypoint)
[3169]71                    thisname = 'Point%d' %count
72                    names.append(thisname)
[3159]73                    count += 1
[3169]74                    s = '%.2f,%.2f,%s,%.2f \n' %(xpoint,ypoint,thisname,0.0)
[3159]75                    fid.write(s)
[3158]76    else:
[3159]77        plotx = arange(MOSTxmin,MOSTxmax,5000.0)
[3158]78        for j, xpoint in enumerate(plotx):
[3159]79            ypoint = m*xpoint+c
80            if ypoint > testy and ypoint < MOSTymax: #testy
81                if xpoint > MOSTxmin and xpoint < MOSTxmax:
82                    xplot.append(xpoint)
83                    yplot.append(ypoint)
[3169]84                    thisname = 'Point%d' %count
85                    names.append(thisname)
[3159]86                    count += 1
[3169]87                    s = '%.2f,%.2f,%s,%.2f \n' %(xpoint,ypoint,thisname,0.0)
[3159]88                    fid.write(s)
[3158]89
[3159]90    plot(x_bound, y_bound, xplot, yplot,'b+')
[3169]91    for i, string in enumerate(names):
92        if xplot[i] > 240000 and xplot[i] < 340000:
93            text(xplot[i],yplot[i],string,fontsize=7)
[3159]94
95axis([240000,340000, miny, maxy])
[3158]96savefig('boundarycomparison')
97close('all')
Note: See TracBrowser for help on using the repository browser.