Skip to content

Commit

Permalink
Merge 6afb3a6 into 94b89a6
Browse files Browse the repository at this point in the history
  • Loading branch information
wsmitchell3 committed Jul 31, 2018
2 parents 94b89a6 + 6afb3a6 commit edd6966
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions aprslib/util/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
from math import floor
import re

__all__=["degrees_to_ddm",
"latitude_to_ddm",
"longitude_to_ddm",
"comment_altitude",
"floor",
"remove_WIDEn_N",
]

def degrees_to_ddm(dd):
degrees = int(floor(dd))
Expand Down Expand Up @@ -34,3 +42,12 @@ def comment_altitude(altitude):
return "/A={0:06.0f}".format(altitude)


def remove_WIDEn_N(path):
"""
Remove WIDEn-N entries and asterisks from path, leaving only digi names
path: path of parsed packet (list of strings)
returns: list of digipeaters that digipeated packet, in order
"""
path = map(lambda x: re.sub('\*$', '', x), path) # Remove asterisks
path = list(filter(lambda x: not re.match(r'WIDE[0-9\-\*]*$', x), path))
return(path)

0 comments on commit edd6966

Please sign in to comment.