Example #1
0
def render_condition(data, query):
    """Emoji encoded weather condition (c)
    """

    weather_condition = WEATHER_SYMBOL[WWO_CODE[data['weatherCode']]]
    spaces = " "*(WEATHER_SYMBOL_WIDTH_VTE.get(weather_condition) - 1)

    return weather_condition + spaces
Example #2
0
def render_condition_plain(data, query):
    """Plain text weather condition (x)
    """

    weather_condition = WEATHER_SYMBOL_PLAIN[WWO_CODE[data['weatherCode']]]
    spaces = " " * (WEATHER_SYMBOL_WIDTH_VTE.get(weather_condition) - 1)

    return weather_condition + spaces
Example #3
0
def render_condition(data, query):
    """Emoji encoded weather condition (c)
    """

    if query.get("view") == "v2n":
        weather_condition = WEATHER_SYMBOL_WI_NIGHT.get(
            WWO_CODE.get(data['weatherCode'], "Unknown"))
        spaces = "  "
    elif query.get("view") == "v2d":
        weather_condition = WEATHER_SYMBOL_WI_DAY.get(
            WWO_CODE.get(data['weatherCode'], "Unknown"))
        spaces = "  "
    else:
        weather_condition = WEATHER_SYMBOL.get(
            WWO_CODE.get(data['weatherCode'], "Unknown"))
        spaces = " " * (3 - WEATHER_SYMBOL_WIDTH_VTE.get(weather_condition, 1))

    return weather_condition + spaces