Browse Source

s/compass/cardinal/

debian-sid
Tom Payne 14 years ago
parent
commit
9c5fbd6c5c
  1. 4
      igc2kmz/__init__.py
  2. 6
      igc2kmz/coord.py

4
igc2kmz/__init__.py

@ -27,7 +27,7 @@ import urlparse
import third_party.pygooglechart as pygooglechart
from color import bilinear_gradient, default_gradient
from coord import rad_to_compass
from coord import rad_to_cardinal
import kml
import kmz
from scale import Scale, TimeScale, ZeroCenteredScale
@ -623,7 +623,7 @@ class Flight(object):
dict['duration'] = '%dm %02ds' % divmod(duration, 60)
dict['accumulated_altitude_gain'] = total_dz_positive
dict['accumulated_altitude_loss'] = total_dz_negative
dict['drift_direction'] = rad_to_compass(theta + pi)
dict['drift_direction'] = rad_to_cardinal(theta + pi)
extended_data = kml.ExtendedData.dict(dict)
if title == 'thermal':
name = '%dm at %.1fm/s' % (dz, dz / dt)

6
igc2kmz/coord.py

@ -19,13 +19,13 @@ from math import acos, asin, atan2, cos, pi, sin, sqrt
R = 6371000.0
compass = 'N NNE NE ENE E ESE SE SSE S SSW SW WSW W WNW NW NNW'.split()
cardinal = 'N NNE NE ENE E ESE SE SSE S SSW SW WSW W WNW NW NNW'.split()
def rad_to_compass(rad):
def rad_to_cardinal(rad):
while rad < 0.0:
rad += 2 * pi
return compass[int(8 * rad / pi + 0.5) % 16]
return cardinal[int(8 * rad / pi + 0.5) % 16]
class degreeattr(object):

Loading…
Cancel
Save