def bearing_2_status(d):
    """ Converts wind direction in degrees to a winddirection in letters
    Used in wind devices

    Args:
        d (float): winddirection in degrees, 0 - 360

    Returns:
        description of the wind direction, eg. "NNE", WNW", etc.

    Ref:
        Based on https://gist.github.com/RobertSudwarts/acf8df23a16afdb5837f
    """
    dirs = ["N", "NNE", "NE", "ENE", "E", "ESE", "SE", "SSE",
            "S", "SSW", "SW", "WSW", "W", "WNW", "NW", "NNW"]

    count = len(dirs)  # Number of entries in list
    step = 360 / count  # Wind direction is in steps of 22.5 degrees (360/16)
    ix = int((d + (step / 2)) / step)  # Calculate index in the list
    return dirs[ix % count]