def UV(): currentStateAQI = IndexAirQuality() resultAQI = queryAQI() arrowAQI = arrowAQ() tempCurrentC = str(calcC()) tempCurrentC = tempCurrentC[:2] arrowHI = dirArrow() direction = dirHI() resultUVI = queryUV() colorHI = colorIndexHeat() colorAQI = colorIndexAir() colorUVI = colorUV() currentStateUVI = IndexUV() tipUVI = tipsUVI() noMedia = noMediaUV() indexHeatState = indexHeatStateColor() return render_template('UV.html', noMedia=noMedia, colorUVI=colorUVI, colorHI=colorHI, colorAQI=colorAQI, resultUVI=resultUVI, currentStateUVI=currentStateUVI, direction=direction, resultAQI=resultAQI, indexHeatState=indexHeatState, tempCurrentC=tempCurrentC, currentStateAQI=currentStateAQI, tipUVI=tipUVI, arrowHI=arrowHI, arrowAQI=arrowAQI)
def IndexUV(): resultUVI = queryUV() if resultUVI < 2.9: currentStateUVI = 'Low' return currentStateUVI elif 2.9 > resultUVI and resultUVI <= 5.9: currentStateUVI = 'Moderate' return currentStateUVI elif 6 > resultUVI and resultUVI <= 7.9: currentStateUVI = 'High' return currentStateUVI elif 8 > resultUVI and resultUVI <= 10.9: currentStateUVI = 'Very-High' return currentStateUVI else: currentStateUVI = 'Extreme' return currentStateUVI
def colorUV(): resultUVI = queryUV() if resultUVI < 2.9: colorUVI = 'Green' return colorUVI elif 2.9 < resultUVI <= 5.9: colorUVI = 'Yellow' return colorUVI elif 6 < resultUVI <= 7.9: colorUVI = 'Orange' return colorUVI elif 8 < resultUVI <= 10.9: colorUVI = 'Red' return colorUVI else: colorUVI = 'Violet' return colorUVI
def noMediaUV(): resultUVI = queryUV() if resultUVI < 2.9: noMedia = '12' return noMedia elif 2.9 > resultUVI and resultUVI <= 5.9: noMedia = '13' return noMedia elif 6 > resultUVI and resultUVI <= 7.9: noMedia = '14' return noMedia elif 8 > resultUVI and resultUVI <= 10.9: noMedia = '15' return noMedia else: noMedia = '16' return noMedia
def tipsUVI(): currentStateUVI = queryUV() if currentStateUVI == 'Low': from tips import GR tipUVI = GR() return tipUVI elif currentStateUVI == 'Moderate': from tips import YE tipUVI = YE() return tipUVI elif currentStateUVI == 'High': from tips import OR tipUVI = OR() return tipUVI elif currentStateUVI == 'Very-High': from tips import RE tipUVI = RE() return tipUVI else: from tips import VI tipUVI = VI() return tipUVI