diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2005-03-26 22:12:39 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2005-03-26 22:12:39 +0000 |
commit | 20c3cfe0fb5bdbbf339b36044d66ebd3cf53d664 (patch) | |
tree | 8a56d7db57842f75db125c0d700b8c2e5ba5430c /gpsprof | |
parent | ed29b757aabf3ca64ad968d2283056e1f86ad125 (diff) | |
download | gpsd-20c3cfe0fb5bdbbf339b36044d66ebd3cf53d664.tar.gz |
Teach gpsprof to handle the case where altitudes aren't available.
Diffstat (limited to 'gpsprof')
-rwxr-xr-x | gpsprof | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -68,14 +68,17 @@ class spaceplot: for i in range(len(recentered)): (lat, lon) = recentered[i][:2] (raw1, raw2, alt) = self.fixes[i] - if alt > -999 : + if alt > gps.ALTITUDE_NOT_VALID: 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 alt_num == 0: + alt_avg = gps.ALTITUDE_NOT_VALID + else: + alt_avg = alt_sum / alt_num if centroid[0] < 0: latstring = "%fS" % -centroid[0] elif centroid[0] == 0: @@ -97,7 +100,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 from %f"\n' % alt_avg + if alt_avg != gps.ALTITUDE_NOT_VALID: + fmt += 'set y2label "Meters Altitude from %f"\n' % alt_avg fmt += 'set border 15\n' fmt += 'set ytics nomirror\n' fmt += 'set y2tics\n' @@ -111,7 +115,8 @@ class spaceplot: fmt += "set arrow from 0,-chlen to 0,chlen nohead\n" fmt += 'plot cx(t, cep),cy(t, cep) title "CEP (50%%) = %f meters", ' % (cep_meters) fmt += ' "%s" using 1:2 with points ls 3 title "%d GPS fixes" , ' % (file, len(self.fixes)) - fmt += '"%s" using ( %f ):($5 > -999 ? $5 - %f : 1/0) axes x1y2 with points ls 2 title " %d Altitude fixes, Average = %f" \n' % ( file, lon_max + 1, alt_avg, alt_num, alt_avg) + if alt_avg != gps.ALTITUDE_NOT_VALID: + fmt += '"%s" using ( %f ):($5 > %d ? $5 - %f : 1/0) axes x1y2 with points ls 2 title " %d Altitude fixes, Average = %f" \n' % ( file, lon_max + 1, gps.ALTITUDE_NOT_VALID, alt_avg, alt_num, alt_avg) return fmt class uninstrumented: |