from pylab import * import csv, os, Gnuplot, Gnuplot.funcutils g = Gnuplot.Gnuplot(debug=1) NMI = 1852.0 D2R = pi/180.0 def read_csv_file(filename): data = [] for row in csv.reader(open(filename)): data.append(row) return data def process_gps_data(data): latitude = [] longitude = [] intensity = [] intensitylow = [] for row in data: latitude.append(float(row[0][0:2]) + \ float(row[0][2:])/60.0) longitude.append((float(row[1][0:3]) + \ float(row[1][3:])/60.0)) intensity.append(float(row[2])) intensitylow.append(float(row[3])) return (array(latitude), array(longitude), \ array(intensity), array(intensitylow)) y=read_csv_file('/root/projects/detection/logs/scryturmcut') (lat, long, intensity,intensitylow) = process_gps_data(y) # translate spherical coordinates to Cartesian py = (lat-min(lat))*NMI*60.0 px = (long-min(long))*NMI*60.0*cos(D2R*lat) #intensitylow=intensitylow*4 newy=[] for x,yz,z,zz in zip(px,py,intensity,intensitylow): newy.append((x,yz,z,zz)) #gnuplot commands g('set parametric') g('set style data line') g('set surface') g('set key') g('unset contour') g('set dgrid3d 40,40,10') g('set xlabel "metres EW"') g('set ylabel "metres SN"') g('set label "signal intensity"at -60,0,0') g('set view 60,20') g.title("wasserturm 13 March 2011") g('set term png size 1024,768') #g('set term png size 14043,9933') # A0 g('set output "/root/projects/detection/logimages/scryturmcut.png"') g.splot(Gnuplot.Data(newy, using=(1,2,3), with='lines', title='high frequency'),Gnuplot.Data(newy, using=(1,2,4), with='lines', title='low frequency'))