def dm2dd(degrees, minutes, cardinal):
    """convert coordinate format with degrees and minutes to degrees"""
    dd = degrees + minutes / 60.0
    if cardinal in ('S', 'W'):
        dd *= -1
    return dd