def degree_to_compass(degree):
    """
    Converts the wind direction from degrees to a compass bearing.

    Shamelessly copied from @steve-gregory
    https://stackoverflow.com/questions/7490660/converting-wind-direction-in-angles-to-text-words
    """
    val      = int((degree / 22.5) + .5)
    bearings = ["N","NNE","NE","ENE","E","ESE", "SE", "SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"]
    return bearings[val % 16]