source: anuga_work/production/hobart_2006/plot_data.py @ 7855

Last change on this file since 7855 was 4580, checked in by sexton, 18 years ago

minor updates for gauge names plus plotting files

File size: 1.3 KB
Line 
1import project
2
3from pylab import *
4
5#import pylab as p1
6#import mpl3d.mplot3d as p3
7
8ion()
9
10# load data
11def get_data_from_file(filename):
12
13    fid = open(filename)
14    lines = fid.readlines()
15    fid.close()   
16    x = zeros((len(lines),1), Float)
17    y = zeros((len(lines),1), Float)
18    z = zeros((len(lines),1), Float)
19    i = 0
20    for line in lines[1:]:
21        fields = line.split(',')
22        x[i] = float(fields[0])
23        y[i] = float(fields[1])
24        z[i] = float(fields[2])
25        i = i + 1
26
27    return x, y, z
28
29x, y, z = get_data_from_file(project.offshore_dem_name_aho11+'.xya')
30# interpolate x,y to X,Y grid?
31
32plot(x,y,'.')
33xlabel('easting')
34ylabel('northing')
35axis([min(x),max(x),min(y),min(z)])
36import sys; sys.exit() 
37
38fig = p1.figure(1)
39ax = p3.Axes3D(fig)
40#ax.plot_surface(x,y,z)
41#ax.plot_wireframe(x,y,z)
42#ax.plot3D(ravel(x,y,z))
43ax.set_xlabel('easting')
44ax.set_ylabel('northing')
45ax.set_zlabel('elevation')
46fig.add_axes(ax)
47p1.show()
48surfacefig = 'solution_surface'
49p1.savefig(surfacefig)
50p1.close()
51
52# example 1
53X = rand(20,20)
54im = imshow(X)
55
56# example 2
57delta = 0.025
58x = y = arange(-3.0,3,delta)
59X, Y = meshgrid(x,y)
60Z1 = bivariate_normal(X,Y,1.0,1.0,0.0,0.0)
61Z2 = bivariate_normal(X,Y,1.5,0.5,1.0,1.0)
62im = imshow(Z2-Z1,interpolation='bilinear')
63axis('off')
Note: See TracBrowser for help on using the repository browser.