summaryrefslogtreecommitdiff
path: root/gpsprof
diff options
context:
space:
mode:
authorGary E. Miller <gem@rellim.com>2005-03-26 20:20:52 +0000
committerGary E. Miller <gem@rellim.com>2005-03-26 20:20:52 +0000
commit4183f3f66aff6a620442e4d9905629107e393ada (patch)
tree993c0619c2c18b794e3005bf9d747df493e53c4e /gpsprof
parent798dca2d74f6408fd1e63a941bc2d5b9f3537644 (diff)
downloadgpsd-4183f3f66aff6a620442e4d9905629107e393ada.tar.gz
gpsprof: spaceplot now has altitude on the right side of the plot...
...and average altitiude displayed.
Diffstat (limited to 'gpsprof')
-rwxr-xr-xgpsprof14
1 files changed, 12 insertions, 2 deletions
diff --git a/gpsprof b/gpsprof
index eb77acef..ab12ffd4 100755
--- a/gpsprof
+++ b/gpsprof
@@ -62,11 +62,20 @@ class spaceplot:
cep_meters = gps.EarthDistance(centroid[:2], self.fixes[len(self.fixes)/2][:2])
# Convert fixes to offsets from centroid in meters
recentered = map(lambda fix: gps.MeterOffset(centroid, fix[:2]), self.fixes)
+ alt_sum = 0
+ alt_num = 0
+ lon_max = -9999
for i in range(len(recentered)):
(lat, lon) = recentered[i][:2]
(raw1, raw2, alt) = self.fixes[i]
+ if alt > -999 :
+ alt_sum += alt
+ alt_num += 1
+ if lon > lon_max :
+ lon_max = lon
self.fp.write("%f %f %f %f %f\n" % (lat, lon, raw1, raw2, alt))
self.fp.flush()
+ alt_avg = alt_sum / alt_num
if centroid[0] < 0:
latstring = "%fS" % -centroid[0]
elif centroid[0] == 0:
@@ -88,7 +97,8 @@ class spaceplot:
fmt += 'set style line 3 pt 2 # Looks good on X11\n'
fmt += 'set xlabel "Meters east from %s"\n' % lonstring
fmt += 'set ylabel "Meters north from %s"\n' % latstring
- fmt += 'set y2label "Meters Altitude"\n'
+ fmt += 'set y2label "Meters Altitude, Average %g"\n' % alt_avg
+ fmt += 'set border 15\n'
fmt += 'set y2tics\n'
fmt += 'cep=%f\n' % d((0,0), recentered[len(self.fixes)/2])
fmt += 'set parametric\n'
@@ -98,7 +108,7 @@ class spaceplot:
fmt += 'chlen = cep/20\n'
fmt += "set arrow from -chlen,0 to chlen,0 nohead\n"
fmt += "set arrow from 0,-chlen to 0,chlen nohead\n"
- fmt += 'plot cx(t, cep),cy(t, cep) title "CEP (50%%) = %f meters", "%s" using 1:2 with points ls 3 title "%d GPS fixes" , "%s" using (0):($5 > -999 ? $5 : 1/0) axes x1y2 with points ls 2 title "Alt" \n' % (cep_meters, file, len(self.fixes), file)
+ fmt += 'plot cx(t, cep),cy(t, cep) title "CEP (50%%) = %f meters", "%s" using 1:2 with points ls 3 title "%d GPS fixes" , "%s" using ( %f ):($5 > -999 ? $5 : 1/0) axes x1y2 with points ls 2 title "Altitude, Average = %f" \n' % (cep_meters, file, len(self.fixes), file, lon_max + 1, alt_avg)
return fmt
class uninstrumented: