ampledata / aprs

Python APRS Module
https://github.com/ampledata/aprs
Other
95 stars 53 forks source link

Fix zero padding bug in dec2dm functions. #8

Closed darksidelemm closed 8 years ago

ampledata commented 8 years ago

Thanks for the PR, can you describe the bug/fix?

darksidelemm commented 8 years ago

Hi Greg,

The dec2dm functions were incorrectly padding latitudes and longitudes incorrectly. The APRS spec calls for latitudes in DDMM.MM and longitudes in DDDMM.MM format, whereas in many situations (i.e. where the minutes portion was <10 minutes, or whole degrees <10 for latitude, or <100 for longitude) would not be leading-zero padded, resulting in an incorrect string.

My fix, while not being nicely pythonic, does add in the leading zero padding.

As an example, for a latitude of -38.01, the old code would return: '380.60S' which has dropped the leading zero in the minutes section. The new code returns: '3800.60S'

Cheers, Mark

On Sat, Mar 5, 2016 at 5:31 AM, Greg Albrecht notifications@github.com wrote:

Thanks for the PR, can you describe the bug/fix?

— Reply to this email directly or view it on GitHub https://github.com/ampledata/aprs/pull/8#issuecomment-192411952.