def get_cardinal_direction(direction: int) -> str:  # noqa
    """
    Returns the cardinal direction (NSEW) for a degree direction

    Wind Direction - Cheat Sheet:

    (360) -- 011/012 -- 033/034 -- (045) -- 056/057 -- 078/079 -- (090)

    (090) -- 101/102 -- 123/124 -- (135) -- 146/147 -- 168/169 -- (180)

    (180) -- 191/192 -- 213/214 -- (225) -- 236/237 -- 258/259 -- (270)

    (270) -- 281/282 -- 303/304 -- (315) -- 326/327 -- 348/349 -- (360)
    """
    ret = ''
    if not isinstance(direction, int):
        direction = int(direction)
    # Convert to range [0 360]
    while direction < 0:
        direction += 360
    direction = direction % 360
    if 304 <= direction <= 360 or 0 <= direction <= 56:
        ret += 'N'
        if 304 <= direction <= 348:
            if 327 <= direction <= 348:
                ret += 'N'
            ret += 'W'
        elif 12 <= direction <= 56:
            if 12 <= direction <= 33:
                ret += 'N'
            ret += 'E'
    elif 124 <= direction <= 236:
        ret += 'S'
        if 124 <= direction <= 168:
            if 147 <= direction <= 168:
                ret += 'S'
            ret += 'E'
        elif 192 <= direction <= 236:
            if 192 <= direction <= 213:
                ret += 'S'
            ret += 'W'
    elif 57 <= direction <= 123:
        ret += 'E'
        if 57 <= direction <= 78:
            ret += 'NE'
        elif 102 <= direction <= 123:
            ret += 'SE'
    elif 237 <= direction <= 303:
        ret += 'W'
        if 237 <= direction <= 258:
            ret += 'SW'
        elif 282 <= direction <= 303:
            ret += 'NW'
    return ret
def get_cardinal_direction ( direction : int ) -> str : ret = '' if not isinstance ( direction , int ) : direction = int ( direction ) while direction < 0 : direction += 360 direction = direction % 360 if 304 <= direction <= 360 or 0 <= direction <= 56 : ret += 'N' if 304 <= direction <= 348 : if 327 <= direction <= 348 : ret += 'N' ret += 'W' elif 12 <= direction <= 56 : if 12 <= direction <= 33 : ret += 'N' ret += 'E' elif 124 <= direction <= 236 : ret += 'S' if 124 <= direction <= 168 : if 147 <= direction <= 168 : ret += 'S' ret += 'E' elif 192 <= direction <= 236 : if 192 <= direction <= 213 : ret += 'S' ret += 'W' elif 57 <= direction <= 123 : ret += 'E' if 57 <= direction <= 78 : ret += 'NE' elif 102 <= direction <= 123 : ret += 'SE' elif 237 <= direction <= 303 : ret += 'W' if 237 <= direction <= 258 : ret += 'SW' elif 282 <= direction <= 303 : ret += 'NW' return ret
Returns the cardinal direction (NSEW) for a degree direction

    Wind Direction - Cheat Sheet:

    (360) -- 011/012 -- 033/034 -- (045) -- 056/057 -- 078/079 -- (090)

    (090) -- 101/102 -- 123/124 -- (135) -- 146/147 -- 168/169 -- (180)

    (180) -- 191/192 -- 213/214 -- (225) -- 236/237 -- 258/259 -- (270)

    (270) -- 281/282 -- 303/304 -- (315) -- 326/327 -- 348/349 -- (360)