import os
import re
import webbrowser
import pdfkit
import time
import multiprocessing
import json
from PIL import Image
# from pyvirtualdisplay import Display
unavailableImg = "https://farmonaut.com/Images/unavailable.jpg"
unavailableImgDecisionStyle = "width: 250px; height: auto;"
companyLogos = {
'farmonaut': 'report_images/farmonaut_logo_black.png',
}
options = {
"enable-local-file-access": "",
"page-height": "192mm",
"page-width": "136mm",
"margin-top": "6mm",
"margin-bottom": "6mm",
"margin-left": "8mm",
"margin-right": "8mm",
# "font": "report_fonts/Noto_Sans/NotoSans-Medium.ttf",
# 'page-size': 'A4',
# 'margin-top': '0.75in',
}
defaultValues = {
"mapImgSize": None,
"fieldImgPaddings": (0, 0),
"mapImg": '',
"decisionTreeFieldDirImg": unavailableImg,
"decisionTreeLaterIrriP": "Not Available",
"decisionTreeLaterCropP": "Not Available",
"decisionTreeEarlyCropP": "Not Available",
"decisionTreeEarlyIrriP": "Not Available",
"decisionTreeCloudyIrriP": "Not Available",
"decisionTreeCloudyCropP": "Not Available",
"weather1DateTd": "NA",
"weather2DateTd": "NA",
"weather3DateTd": "NA",
"weather4DateTd": "NA",
"weather5DateTd": "NA",
"weather6DateTd": "NA",
"weather7DateTd": "NA",
"weather1SummaryTd": "NA",
"weather2SummaryTd": "NA",
"weather3SummaryTd": "NA",
"weather4SummaryTd": "NA",
"weather5SummaryTd": "NA",
"weather6SummaryTd": "NA",
"weather7SummaryTd": "NA",
"weather1MinTempTd": "NA",
"weather2MinTempTd": "NA",
"weather3MinTempTd": "NA",
"weather4MinTempTd": "NA",
"weather5MinTempTd": "NA",
"weather6MinTempTd": "NA",
"weather7MinTempTd": "NA",
"weather1MaxTempTd": "NA",
"weather2MaxTempTd": "NA",
"weather3MaxTempTd": "NA",
"weather4MaxTempTd": "NA",
"weather5MaxTempTd": "NA",
"weather6MaxTempTd": "NA",
"weather7MaxTempTd": "NA",
"weather1RainTd": "NA",
"weather2RainTd": "NA",
"weather3RainTd": "NA",
"weather4RainTd": "NA",
"weather5RainTd": "NA",
"weather6RainTd": "NA",
"weather7RainTd": "NA",
"weather1MaxPrecipitationTd": "NA",
"weather2MaxPrecipitationTd": "NA",
"weather3MaxPrecipitationTd": "NA",
"weather4MaxPrecipitationTd": "NA",
"weather5MaxPrecipitationTd": "NA",
"weather6MaxPrecipitationTd": "NA",
"weather7MaxPrecipitationTd": "NA",
"weather1CloudCoverTd": "NA",
"weather2CloudCoverTd": "NA",
"weather3CloudCoverTd": "NA",
"weather4CloudCoverTd": "NA",
"weather5CloudCoverTd": "NA",
"weather6CloudCoverTd": "NA",
"weather7CloudCoverTd": "NA",
"generationDateValueH6": "NA",
"visitDateValueH6": "NA",
"addressValueH6": "undefined",
"fieldAreaValue": "NA",
"latValue": "NA",
"longValue": "NA",
"weatherValueStn": "NA",
"weatherValueCloud": "NA",
"weatherValueTempMin": "NA",
"weatherValueTempMax": "NA",
"weatherValueWind": "NA",
"weatherValueWindDir": "NA",
"weatherValueHumidity": "NA",
"weatherValuePressure": "NA",
"socIndexImg": unavailableImg,
"socGraphImg": unavailableImg,
"socGoodHeightImg": unavailableImg,
"socSmallHeightImg": unavailableImg,
"ndviIndexImg": unavailableImg,
"ndviGraphImg": unavailableImg,
"ndviGoodHeightImg": unavailableImg,
"ndviSmallHeightImg": unavailableImg,
"ndwiIndexImg": unavailableImg,
"ndwiGraphImg": unavailableImg,
"ndwiGoodHeightImg": unavailableImg,
"ndwiSmallHeightImg": unavailableImg,
"ndmiIndexImg": unavailableImg,
"ndmiGraphImg": unavailableImg,
"ndmiGoodHeightImg": unavailableImg,
"ndmiSmallHeightImg": unavailableImg,
"saviIndexImg": unavailableImg,
"saviGraphImg": unavailableImg,
"saviGoodHeightImg": unavailableImg,
"saviSmallHeightImg": unavailableImg,
"eviIndexImg": unavailableImg,
"eviGraphImg": unavailableImg,
"eviGoodHeightImg": unavailableImg,
"eviSmallHeightImg": unavailableImg,
"ndreIndexImg": unavailableImg,
"ndreGraphImg": unavailableImg,
"ndreGoodHeightImg": unavailableImg,
"ndreSmallHeightImg": unavailableImg,
"rgbTCIImg": unavailableImg,
"rgbETCIImg": unavailableImg,
"soilMoistImg": unavailableImg,
"evapoImg": unavailableImg,
"rviImg": unavailableImg,
"colorBlindImg": unavailableImg,
"decisionTreeBasicImg": unavailableImg,
"weatherGraphImg": unavailableImg
}
allReportTestValues = {
"mapImgSize": '(168, 336)',
"fieldImgPaddings": '(0.5328, 0.1)',
"mapImg": "report_images/fieldMap.jpg",
"decisionTreeFieldDirImg": "report_images/dirImg.png",
"decisionTreeLaterIrriP": "● check these directions of your farm for irrigation problem - N, NW, NE, W, C, E, SW, SE, S",
"decisionTreeLaterCropP": "● check these directions of your farm for irrigation problem - N, NW, NE, W, C, E, SW, SE, S",
"decisionTreeEarlyCropP": "● check these directions of your farm for irrigation problem - N, NW, NE, W, C, E, SW, SE, S",
"decisionTreeEarlyIrriP": "● check these directions of your farm for irrigation problem - N, NW, NE, W, C, E, SW, SE, S",
"decisionTreeCloudyIrriP": "● check these directions of your farm for irrigation problem - N, NW, NE, W, C, E, SW, SE, S",
"decisionTreeCloudyCropP": "● check these directions of your farm for irrigation problem - N, NW, NE, W, C, E, SW, SE, S",
"socIndexImg": "report_images/reportPics/soc_piechart.png",
"socGraphImg": "report_images/reportPics/soc_linegraph.png",
"socGoodHeightImg": "report_images/reportPics/soc.png",
"socSmallHeightImg": "report_images/reportPics/soc_cmap2.png",
"ndviIndexImg": "report_images/reportPics/ndvi_piechart.png",
"ndviGraphImg": "report_images/reportPics/ndvi_linegraph.png",
"ndviGoodHeightImg": "report_images/reportPics/ndvi.png",
"ndviSmallHeightImg": "report_images/reportPics/ndvi_cmap2.png",
"ndwiIndexImg": "report_images/reportPics/ndwi_piechart.png",
"ndwiGraphImg": "report_images/reportPics/ndwi_linegraph.png",
"ndwiGoodHeightImg": "report_images/reportPics/ndwi.png",
"ndwiSmallHeightImg": "report_images/reportPics/ndwi_cmap2.png",
"ndmiIndexImg": "report_images/reportPics/ndmi_piechart.png",
"ndmiGraphImg": "report_images/reportPics/ndmi_linegraph.png",
"ndmiGoodHeightImg": "report_images/reportPics/ndmi.png",
"ndmiSmallHeightImg": "report_images/reportPics/ndmi_cmap2.png",
"saviIndexImg": "report_images/reportPics/savi_piechart.png",
"saviGraphImg": "report_images/reportPics/savi_linegraph.png",
"saviGoodHeightImg": "report_images/reportPics/savi.png",
"saviSmallHeightImg": "report_images/reportPics/savi_cmap2.png",
"eviIndexImg": "report_images/reportPics/evi_piechart.png",
"eviGraphImg": "report_images/reportPics/evi_linegraph.png",
"eviGoodHeightImg": "report_images/reportPics/evi.png",
"eviSmallHeightImg": "report_images/reportPics/evi_cmap2.png",
"ndreIndexImg": "report_images/reportPics/ndre_piechart.png",
"ndreGraphImg": "report_images/reportPics/ndre_linegraph.png",
"ndreGoodHeightImg": "report_images/reportPics/ndre.png",
"ndreSmallHeightImg": "report_images/reportPics/ndre_cmap2.png",
"rgbTCIImg": "report_images/reportPics/TCI.png",
"rgbETCIImg": "report_images/reportPics/ETCI.png",
"soilMoistImg": "report_images/reportPics/rsm.png",
"evapoImg": "report_images/reportPics/evapo.png",
# "rviImg": "report_images/reportPics/rvi.png",
"colorBlindImg": "report_images/reportPics/hybrid_blind.png",
"decisionTreeBasicImg": "report_images/reportPics/hybrid.png",
"weatherGraphImg": "report_images/reportPics/NqvmukdL9Wex35VuQ0jbPPJlXoV2_weather_linegraph.png"
}
fileName = "report_template.html"
tmpFileName = "report_tmp.html"
# functions
def createTranslationJson(langs, outFile="uploadTrans.json"):
allTransObj = {}
for langCode in langs:
translations = None
fileName = "json/app_{langCode}.json".format(langCode=langCode)
with open(fileName, encoding="utf8") as f:
jsonStr = f.read()
translations = json.loads(jsonStr) # expects a dictionary
allTransObj[langCode] = translations
with open(outFile, 'w', encoding="utf8") as f:
f.write(str(allTransObj))
def removeKeysInTranslation(langs, keys):
# raise Exception("this func is not working")
for langCode in langs:
translations = None
fileName = "json/app_{langCode}.json".format(langCode=langCode)
with open(fileName, encoding="utf8") as f:
jsonStr = f.read()
translations = json.loads(jsonStr) # expects a dictionary
for key in keys:
if key in translations:
translations.pop(key)
with open(fileName, 'w', encoding="utf8") as f:
f.write(str(translations))
def getValueIfPresent(dict={}, key=None):
return dict[key] if dict.contains(key) else None
def openFile(htmlStr=None, file=None):
tmpFileName = None
if htmlStr:
tmpFileName = "report_tmp.html"
with open(tmpFileName, 'w') as f:
f.write(htmlStr)
webbrowser.open(file or tmpFileName or fileName)
def createPdf(outfile=None, file=None):
pdfFileName = outfile or "out.pdf"
path_wkhtmltopdf = r'C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe'
config = pdfkit.configuration(wkhtmltopdf=path_wkhtmltopdf)
# absPath = os.path.abspath(fileName)
pdfkit.from_file(file or fileName, pdfFileName,
configuration=config, options=options)
def createPdf2(outfile=None, file=None):
pdfFileName = outfile or "out.pdf"
path_wkhtmltopdf = r'C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe'
config = pdfkit.configuration(wkhtmltopdf=path_wkhtmltopdf)
# absPath = os.path.abspath(fileName)
# with Display():
# pdfkit.from_file(file or fileName, pdfFileName, configuration=config, options= options)
def createPdfByString(string, outfile=None):
pdfFileName = outfile or "out.pdf"
path_wkhtmltopdf = r'C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe'
config = pdfkit.configuration(wkhtmltopdf=path_wkhtmltopdf)
# absPath = os.path.abspath(fileName)
pdfkit.from_string(string, pdfFileName,
configuration=config, options=options)
def saveToTmpHtml(htmlStr):
with open(tmpFileName, 'w', encoding="utf8") as f:
f.write(htmlStr)
def replaceHtmlData(elementKey, value, htmlStr, initialIndex):
# assuming elements to be none container type
# print(startIndex)
keyIndex = htmlStr.index(elementKey, initialIndex)
startIndex = htmlStr.index(">", keyIndex)
endIndex = htmlStr.index("<", startIndex)
return htmlStr[:startIndex+1]+value+htmlStr[endIndex:], startIndex+len(value)+1
def replaceHtmlEleStyle(elementKey, style, htmlStr, initialIndex):
# assuming elements to be none container type
# print(startIndex)
keyIndex = htmlStr.index(elementKey, initialIndex)
startIndex = htmlStr.index("style=", keyIndex)
endIndex = htmlStr.index('"', startIndex+7)
return htmlStr[:startIndex+7]+style+htmlStr[endIndex:], initialIndex
def replaceHtmlImgSrc(elementKey, src, htmlStr, initialIndex):
# assuming element id is added before src parameter in html
# and also that some src is already added there
keyIndex = htmlStr.index(elementKey, initialIndex)
startIndex = htmlStr.index("src", keyIndex)
endIndex = htmlStr.index('"', startIndex+5)
return htmlStr[:startIndex+5]+src+htmlStr[endIndex:], startIndex+len(src)+1
def replaceHtmlStyle(className, style, htmlStr, initialIndex):
keyIndex = htmlStr.index(className, initialIndex)
startIndex = htmlStr.index("{", keyIndex)
endIndex = htmlStr.index("}", startIndex+1)
return htmlStr[:startIndex+1]+style+htmlStr[endIndex:], startIndex+len(style)+1
def replaceHtmlComments(htmlStr):
pattern = re.compile("\/\*([^\*\/]|\n)*\*\/|", re.MULTILINE)
return re.sub(pattern, "", htmlStr)
def populateData(langCode, translations, allReportValues={}, isTest=False):
# returns the populated data html string
htmlStr = None
initialIndex = 0
with open(fileName) as f:
htmlStr = f.read()
# queries
# translations = None
if isTest:
with open("json/app_{langCode}.json".format(langCode=langCode), encoding="utf8") as f:
jsonStr = f.read()
translations = json.loads(jsonStr) # expects a dictionary
# get data to replace
introPStyle = "font-size: 18px;"
if langCode in ["uz"]:
introPStyle = "font-size: 16px;"
companyLogoDivStyle = "height: 130px; padding-bottom: 16px; text-align: center;"
if langCode in ["uz"]:
companyLogoDivStyle = "height: 100px; padding-bottom: 16px; text-align: center;"
fontStyle = "font-family: NotoSans; src: url('report_fonts/Noto_Sans/NotoSans-Light.ttf') format('truetype');"
allEleStyle = "box-sizing: border-box; font-family: NotoSans;"
if langCode == "bn":
fontStyle = "font-family: HindSiliguri; src: url('report_fonts/Hind_Siliguri/HindSiliguri-Light.ttf') format('truetype');"
allEleStyle = "box-sizing: border-box; font-family: HindSiliguri;"
elif langCode == "ta":
fontStyle = "font-family: NotoSansTamil; src: url('report_fonts/Noto_Sans_Tamil/static/NotoSansTamil/NotoSansTamil-Light.ttf') format('truetype');"
allEleStyle = "box-sizing: border-box; font-family: NotoSansTamil;"
if langCode == "te":
fontStyle = "font-family: NotoSansTelugu; src: url('report_fonts/Noto_Sans_Telugu/static/NotoSansTelugu/NotoSansTelugu-Light.ttf') format('truetype');"
allEleStyle = "box-sizing: border-box; font-family: NotoSansTelugu;"
if langCode == "kn":
fontStyle = "font-family: NotoSansKannada; src: url('report_fonts/Noto_Sans_Kannada/static/NotoSansKannada/NotoSansKannada-Light.ttf') format('truetype');"
allEleStyle = "box-sizing: border-box; font-family: NotoSansKannada;"
colorBlindHeadingStyle = "margin-top: 8px;"
if langCode == "uz":
colorBlindHeadingStyle = "margin-top: 8px; font-size: 20px;"
# companyLogoImg = companyLogos["farmonaut"]
# translation txts
fieldReportHeadingDiv = translations['fieldReportHeadingDiv']
reportInfoP = translations['reportInfoP']
generationDateTitleH6 = translations['generationDateTitleH6']
visitDateTitleH6 = translations['visitDateTitleH6']
fieldDetailsHeadingDiv = translations['fieldDetailsHeadingDiv']
addressTitleH6 = translations['addressTitleH6']
fieldAreaTitleH6 = translations['fieldAreaTitleH6']
locationTitleH6 = translations['locationTitleH6']
latitudeTxt = translations['latitudeTxt']
longitudeTxt = translations['longitudeTxt']
indexHeadingDiv = translations['indexHeadingDiv']
indexTitleTh = translations['indexTitleTh']
indexSerialTh = translations['indexSerialTh']
indexPageTh = translations['indexPageTh']
indexTitle1Td = translations['indexTitle1Td']
indexTitle2Td = translations['indexTitle2Td']
indexTitle3Td = translations['indexTitle3Td']
indexTitle4Td = translations['indexTitle4Td']
indexTitle5Td = translations['indexTitle5Td']
indexTitle6Td = translations['indexTitle6Td']
indexTitle7Td = translations['indexTitle7Td']
indexTitle7_3Td = translations['indexTitle7_3Td']
indexTitle7_6Td = translations['indexTitle7_6Td']
indexTitle8Td = translations['indexTitle8Td']
indexTitle9Td = translations['indexTitle9Td']
indexTitle10Td = translations['indexTitle10Td']
indexTitle11Td = translations['indexTitle11Td']
indexTitle12Td = translations['indexTitle12Td']
indexTitle13Td = translations['indexTitle13Td']
indexTitle14Td = translations['indexTitle14Td']
indexTitle15Td = translations['indexTitle15Td']
indexTitle16Td = translations['indexTitle16Td']
indexTitle17Td = translations['indexTitle17Td']
decisionTreeCloudyCondH4 = translations['decisionTreeCloudyCondH4']
decisionTreeCloudyCondH5 = translations['decisionTreeCloudyCondH5']
decisionTreeNDVICondH4 = translations['decisionTreeNDVICondH4']
decisionTreeNDRECondH4 = translations['decisionTreeNDRECondH4']
decisionTreeETCIH3 = translations['decisionTreeETCIH3']
decisionTreeRVIH3 = translations['decisionTreeRVIH3']
decisionTreeSoilMoistH3 = translations['decisionTreeSoilMoistH3']
decisionTreeNDVIH3 = translations['decisionTreeNDVIH3']
decisionTreeNDREH3 = translations['decisionTreeNDREH3']
decisionTreeNDWIH3 = translations['decisionTreeNDWIH3']
decisionTreeBasicH3 = translations['decisionTreeBasicH3']
# decisionTreeHeadingDiv = translations['decisionTreeHeadingDiv']
# weatherHeadingDiv = translations['weatherHeadingDiv']
weatherTitleStnH3 = translations['weatherTitleStnH3']
weatherTitleCloudH4 = translations['weatherTitleCloudH4']
weatherTitleTempMinH4 = translations['weatherTitleTempMinH4']
weatherTitleTempMaxH4 = translations['weatherTitleTempMaxH4']
weatherTitleWindH4 = translations['weatherTitleWindH4']
weatherTitleWindDirH4 = translations['weatherTitleWindDirH4']
weatherTitleHumidityH4 = translations['weatherTitleHumidityH4']
weatherTitlePressureH4 = translations['weatherTitlePressureH4']
forcastHeadingDiv = translations['forcastHeadingDiv']
weatherDateThH4 = translations['weatherDateThH4']
weatherSummaryThH4 = translations['weatherSummaryThH4']
weatherMinTempThH4 = translations['weatherMinTempThH4']
weatherMaxTempThH4 = translations['weatherMaxTempThH4']
weatherRainThH4 = translations['weatherRainThH4']
weatherMaxPrecipitationThH4 = translations['weatherMaxPrecipitationThH4']
weatherCloudCoverThH4 = translations['weatherCloudCoverThH4']
weatherGraphHeadingDiv = translations['weatherGraphHeadingDiv']
ndviInfoP = translations['ndviInfoP']
scientifiyBackgroundTxt = translations['scientifiyBackgroundTxt']
ndviScientificP = translations['ndviScientificP']
goodHeightCondTxt = translations['goodHeightCondTxt']
smallHeightCondTxt = translations['smallHeightCondTxt']
rgbHeadingDiv = translations['rgbHeadingDiv']
rgbInfoP = translations['rgbInfoP']
colorBlindHeadingDiv = translations['colorBlindHeadingDiv']
rviScientificP = translations['rviScientificP']
soilMoistScientificP = translations['soilMoistScientificP']
eviInfoP = translations['eviInfoP']
eviScientificP = translations['eviScientificP']
saviInfoP = translations['saviInfoP']
saviScientificP = translations['saviScientificP']
ndreSubHeadingDiv = translations['ndreSubHeadingDiv']
ndreInfoP = translations['ndreInfoP']
ndreScientificP = translations['ndreScientificP']
ndwiInfoP = translations['ndwiInfoP']
ndwiScientificP = translations['ndwiScientificP']
ndmiInfoP = translations['ndmiInfoP']
ndmiScientificP = translations['ndmiScientificP']
evapoInfoP = translations['evapoInfoP']
evapoH4 = translations['evapoH4']
soilHealthHeadingDiv = translations['soilHealthHeadingDiv']
soilInfoP = translations['soilInfoP']
decisionTreeScaleH3 = translations['decisionTreeScaleH3']
decisionTreeSummaryTitleH3 = translations['decisionTreeSummaryTitleH3']
decisionTreeCloudyTitleH3 = translations['decisionTreeCloudyTitleH3']
decisionTreeEarlyTitleH3 = translations['decisionTreeEarlyTitleH3']
decisionTreeLaterTitleH3 = translations['decisionTreeLaterTitleH3']
# content generated values
weather1DateTd = allReportValues.get(
'weather1DateTd', None) or defaultValues['weather1DateTd']
weather2DateTd = allReportValues.get(
'weather2DateTd', None) or defaultValues['weather2DateTd']
weather3DateTd = allReportValues.get(
'weather3DateTd', None) or defaultValues['weather3DateTd']
weather4DateTd = allReportValues.get(
'weather4DateTd', None) or defaultValues['weather4DateTd']
weather5DateTd = allReportValues.get(
'weather5DateTd', None) or defaultValues['weather5DateTd']
weather6DateTd = allReportValues.get(
'weather6DateTd', None) or defaultValues['weather6DateTd']
weather7DateTd = allReportValues.get(
'weather7DateTd', None) or defaultValues['weather7DateTd']
weather1SummaryTd = allReportValues.get(
'weather1SummaryTd', None) or defaultValues['weather1SummaryTd']
weather2SummaryTd = allReportValues.get(
'weather2SummaryTd', None) or defaultValues['weather2SummaryTd']
weather3SummaryTd = allReportValues.get(
'weather3SummaryTd', None) or defaultValues['weather3SummaryTd']
weather4SummaryTd = allReportValues.get(
'weather4SummaryTd', None) or defaultValues['weather4SummaryTd']
weather5SummaryTd = allReportValues.get(
'weather5SummaryTd', None) or defaultValues['weather5SummaryTd']
weather6SummaryTd = allReportValues.get(
'weather6SummaryTd', None) or defaultValues['weather6SummaryTd']
weather7SummaryTd = allReportValues.get(
'weather7SummaryTd', None) or defaultValues['weather7SummaryTd']
weather1MinTempTd = allReportValues.get(
'weather1MinTempTd', None) or defaultValues['weather1MinTempTd']
weather2MinTempTd = allReportValues.get(
'weather2MinTempTd', None) or defaultValues['weather2MinTempTd']
weather3MinTempTd = allReportValues.get(
'weather3MinTempTd', None) or defaultValues['weather3MinTempTd']
weather4MinTempTd = allReportValues.get(
'weather4MinTempTd', None) or defaultValues['weather4MinTempTd']
weather5MinTempTd = allReportValues.get(
'weather5MinTempTd', None) or defaultValues['weather5MinTempTd']
weather6MinTempTd = allReportValues.get(
'weather6MinTempTd', None) or defaultValues['weather6MinTempTd']
weather7MinTempTd = allReportValues.get(
'weather7MinTempTd', None) or defaultValues['weather7MinTempTd']
weather1MaxTempTd = allReportValues.get(
'weather1MaxTempTd', None) or defaultValues['weather1MaxTempTd']
weather2MaxTempTd = allReportValues.get(
'weather2MaxTempTd', None) or defaultValues['weather2MaxTempTd']
weather3MaxTempTd = allReportValues.get(
'weather3MaxTempTd', None) or defaultValues['weather3MaxTempTd']
weather4MaxTempTd = allReportValues.get(
'weather4MaxTempTd', None) or defaultValues['weather4MaxTempTd']
weather5MaxTempTd = allReportValues.get(
'weather5MaxTempTd', None) or defaultValues['weather5MaxTempTd']
weather6MaxTempTd = allReportValues.get(
'weather6MaxTempTd', None) or defaultValues['weather6MaxTempTd']
weather7MaxTempTd = allReportValues.get(
'weather7MaxTempTd', None) or defaultValues['weather7MaxTempTd']
weather1RainTd = allReportValues.get(
'weather1RainTd', None) or defaultValues['weather1RainTd']
weather2RainTd = allReportValues.get(
'weather2RainTd', None) or defaultValues['weather2RainTd']
weather3RainTd = allReportValues.get(
'weather3RainTd', None) or defaultValues['weather3RainTd']
weather4RainTd = allReportValues.get(
'weather4RainTd', None) or defaultValues['weather4RainTd']
weather5RainTd = allReportValues.get(
'weather5RainTd', None) or defaultValues['weather5RainTd']
weather6RainTd = allReportValues.get(
'weather6RainTd', None) or defaultValues['weather6RainTd']
weather7RainTd = allReportValues.get(
'weather7RainTd', None) or defaultValues['weather7RainTd']
weather1MaxPrecipitationTd = allReportValues.get(
'weather1MaxPrecipitationTd', None) or defaultValues['weather1MaxPrecipitationTd']
weather2MaxPrecipitationTd = allReportValues.get(
'weather2MaxPrecipitationTd', None) or defaultValues['weather2MaxPrecipitationTd']
weather3MaxPrecipitationTd = allReportValues.get(
'weather3MaxPrecipitationTd', None) or defaultValues['weather3MaxPrecipitationTd']
weather4MaxPrecipitationTd = allReportValues.get(
'weather4MaxPrecipitationTd', None) or defaultValues['weather4MaxPrecipitationTd']
weather5MaxPrecipitationTd = allReportValues.get(
'weather5MaxPrecipitationTd', None) or defaultValues['weather5MaxPrecipitationTd']
weather6MaxPrecipitationTd = allReportValues.get(
'weather6MaxPrecipitationTd', None) or defaultValues['weather6MaxPrecipitationTd']
weather7MaxPrecipitationTd = allReportValues.get(
'weather7MaxPrecipitationTd', None) or defaultValues['weather7MaxPrecipitationTd']
weather1CloudCoverTd = allReportValues.get(
'weather1CloudCoverTd', None) or defaultValues['weather1CloudCoverTd']
weather2CloudCoverTd = allReportValues.get(
'weather2CloudCoverTd', None) or defaultValues['weather2CloudCoverTd']
weather3CloudCoverTd = allReportValues.get(
'weather3CloudCoverTd', None) or defaultValues['weather3CloudCoverTd']
weather4CloudCoverTd = allReportValues.get(
'weather4CloudCoverTd', None) or defaultValues['weather4CloudCoverTd']
weather5CloudCoverTd = allReportValues.get(
'weather5CloudCoverTd', None) or defaultValues['weather5CloudCoverTd']
weather6CloudCoverTd = allReportValues.get(
'weather6CloudCoverTd', None) or defaultValues['weather6CloudCoverTd']
weather7CloudCoverTd = allReportValues.get(
'weather7CloudCoverTd', None) or defaultValues['weather7CloudCoverTd']
generationDateValueH6 = allReportValues.get(
'generationDateValueH6', None) or defaultValues['generationDateValueH6']
visitDateValueH6 = allReportValues.get(
'visitDateValueH6', None) or defaultValues['visitDateValueH6']
addressValueH6 = allReportValues.get(
'addressValueH6', None) or defaultValues['addressValueH6']
fieldAreaValue = allReportValues.get(
'fieldAreaValue', None) or defaultValues['fieldAreaValue']
latValue = allReportValues.get(
'latValue', None) or defaultValues['latValue']
longValue = allReportValues.get(
'longValue', None) or defaultValues['longValue']
weatherValueStn = allReportValues.get(
'weatherValueStn', None) or defaultValues['weatherValueStn']
weatherValueCloud = allReportValues.get(
'weatherValueCloud', None) or defaultValues['weatherValueCloud']
weatherValueTempMin = allReportValues.get(
'weatherValueTempMin', None) or defaultValues['weatherValueTempMin']
weatherValueTempMax = allReportValues.get(
'weatherValueTempMax', None) or defaultValues['weatherValueTempMax']
weatherValueWind = allReportValues.get(
'weatherValueWind', None) or defaultValues['weatherValueWind']
weatherValueWindDir = allReportValues.get(
'weatherValueWindDir', None) or defaultValues['weatherValueWindDir']
weatherValueHumidity = allReportValues.get(
'weatherValueHumidity', None) or defaultValues['weatherValueHumidity']
weatherValuePressure = allReportValues.get(
'weatherValuePressure', None) or defaultValues['weatherValuePressure']
socIndexImg = allReportValues.get(
'socIndexImg', None) or defaultValues['socIndexImg']
socGraphImg = allReportValues.get(
'socGraphImg', None) or defaultValues['socGraphImg']
socGoodHeightImg = allReportValues.get(
'socGoodHeightImg', None) or defaultValues['socGoodHeightImg']
socSmallHeightImg = allReportValues.get(
'socSmallHeightImg', None) or defaultValues['socSmallHeightImg']
ndviIndexImg = allReportValues.get(
'ndviIndexImg', None) or defaultValues['ndviIndexImg']
ndviGraphImg = allReportValues.get(
'ndviGraphImg', None) or defaultValues['ndviGraphImg']
ndviGoodHeightImg = allReportValues.get(
'ndviGoodHeightImg', None) or defaultValues['ndviGoodHeightImg']
ndviSmallHeightImg = allReportValues.get(
'ndviSmallHeightImg', None) or defaultValues['ndviSmallHeightImg']
ndwiIndexImg = allReportValues.get(
'ndwiIndexImg', None) or defaultValues['ndwiIndexImg']
ndwiGraphImg = allReportValues.get(
'ndwiGraphImg', None) or defaultValues['ndwiGraphImg']
ndwiGoodHeightImg = allReportValues.get(
'ndwiGoodHeightImg', None) or defaultValues['ndwiGoodHeightImg']
ndwiSmallHeightImg = allReportValues.get(
'ndwiSmallHeightImg', None) or defaultValues['ndwiSmallHeightImg']
ndmiIndexImg = allReportValues.get(
'ndmiIndexImg', None) or defaultValues['ndmiIndexImg']
ndmiGraphImg = allReportValues.get(
'ndmiGraphImg', None) or defaultValues['ndmiGraphImg']
ndmiGoodHeightImg = allReportValues.get(
'ndmiGoodHeightImg', None) or defaultValues['ndmiGoodHeightImg']
ndmiSmallHeightImg = allReportValues.get(
'ndmiSmallHeightImg', None) or defaultValues['ndmiSmallHeightImg']
saviIndexImg = allReportValues.get(
'saviIndexImg', None) or defaultValues['saviIndexImg']
saviGraphImg = allReportValues.get(
'saviGraphImg', None) or defaultValues['saviGraphImg']
saviGoodHeightImg = allReportValues.get(
'saviGoodHeightImg', None) or defaultValues['saviGoodHeightImg']
saviSmallHeightImg = allReportValues.get(
'saviSmallHeightImg', None) or defaultValues['saviSmallHeightImg']
eviIndexImg = allReportValues.get(
'eviIndexImg', None) or defaultValues['eviIndexImg']
eviGraphImg = allReportValues.get(
'eviGraphImg', None) or defaultValues['eviGraphImg']
eviGoodHeightImg = allReportValues.get(
'eviGoodHeightImg', None) or defaultValues['eviGoodHeightImg']
eviSmallHeightImg = allReportValues.get(
'eviSmallHeightImg', None) or defaultValues['eviSmallHeightImg']
ndreIndexImg = allReportValues.get(
'ndreIndexImg', None) or defaultValues['ndreIndexImg']
ndreGraphImg = allReportValues.get(
'ndreGraphImg', None) or defaultValues['ndreGraphImg']
ndreGoodHeightImg = allReportValues.get(
'ndreGoodHeightImg', None) or defaultValues['ndreGoodHeightImg']
ndreSmallHeightImg = allReportValues.get(
'ndreSmallHeightImg', None) or defaultValues['ndreSmallHeightImg']
rgbTCIImg = allReportValues.get(
'rgbTCIImg', None) or defaultValues['rgbTCIImg']
rgbETCIImg = allReportValues.get(
'rgbETCIImg', None) or defaultValues['rgbETCIImg']
soilMoistImg = allReportValues.get(
'soilMoistImg', None) or defaultValues['soilMoistImg']
evapoImg = allReportValues.get(
'evapoImg', None) or defaultValues['evapoImg']
rviImg = allReportValues.get('rviImg', None) or defaultValues['rviImg']
# print(rviImg, rviImgStyle)
decisionTreeFieldDirImg = allReportValues.get(
'decisionTreeFieldDirImg', None) or defaultValues['decisionTreeFieldDirImg']
mapImg = allReportValues.get('mapImg', None) or defaultValues['mapImg']
fieldImgPaddings = eval(allReportValues.get(
'fieldImgPaddings', None)) or defaultValues['fieldImgPaddings'] # in % ratio
mapImgSize = eval(allReportValues.get(
'mapImgSize', None)) or defaultValues['mapImgSize']
decisionTreeLaterIrriP = allReportValues.get(
'decisionTreeLaterIrriP', None) or defaultValues['decisionTreeLaterIrriP']
decisionTreeLaterCropP = allReportValues.get(
'decisionTreeLaterCropP', None) or defaultValues['decisionTreeLaterCropP']
decisionTreeEarlyCropP = allReportValues.get(
'decisionTreeEarlyCropP', None) or defaultValues['decisionTreeEarlyCropP']
decisionTreeEarlyIrriP = allReportValues.get(
'decisionTreeEarlyIrriP', None) or defaultValues['decisionTreeEarlyIrriP']
decisionTreeCloudyIrriP = allReportValues.get(
'decisionTreeCloudyIrriP', None) or defaultValues['decisionTreeCloudyIrriP']
decisionTreeCloudyCropP = allReportValues.get(
'decisionTreeCloudyCropP', None) or defaultValues['decisionTreeCloudyCropP']
colorBlindImg = allReportValues.get(
'colorBlindImg', None) or defaultValues['colorBlindImg']
decisionTreeBasicImg = allReportValues.get(
'decisionTreeBasicImg', None) or defaultValues['decisionTreeBasicImg']
weatherGraphImg = allReportValues.get(
'weatherGraphImg', None) or defaultValues['weatherGraphImg']
companyLogoImg = allReportValues.get(
"companyLogoImg", None) or companyLogos['farmonaut']
# other items to replace in template
showOnlyRVI = ndviGoodHeightImg == unavailableImg
displayNoneStyle = "display: none"
displayBlockStyle = "display: block"
nonRVIOnlyStyle = displayNoneStyle if showOnlyRVI else displayBlockStyle
rviOnlyStyle = displayNoneStyle if not showOnlyRVI else displayBlockStyle
img = Image.open(rgbETCIImg)
imgWidth, imgHeight = img.size
if mapImgSize == None:
mapImgRatio = imgHeight/imgWidth
else:
mapImgRatio = mapImgSize[1]/mapImgSize[0]
mapImgHeight = 230 if mapImgRatio > 0.92 else 250*mapImgRatio
mapImgWidth = mapImgHeight/mapImgRatio
mapImgHPad = mapImgWidth*fieldImgPaddings[0]/(fieldImgPaddings[0]*2+1)
mapImgVPad = mapImgHeight*fieldImgPaddings[1]/(fieldImgPaddings[1]*2+1)
mapInnerImgH = "230px" if mapImgRatio > 0.92 else "auto"
mapInnerImgW = "auto" if mapImgRatio > 0.92 else "250px"
mapInnerPadH = (270-mapImgWidth)/2
decisionTreeImgInnerDivStyle = "display: flex; justify-content: center; margin-top: 8px; height: %s; width: %s; padding: 0 0 0 %spx" % (
mapInnerImgH, mapInnerImgW, mapInnerPadH)
decisionTreeMapImgStyle = "position: absolute; height: %spx; width: %spx;" % (
mapImgHeight, mapImgWidth)
dirImgHeight = 300 if mapImgRatio > 1 else 300*mapImgRatio
decisionTreeFieldDirImgStyle = "height: %spx; aspect-ratio: %s;" % (
dirImgHeight, imgWidth/imgHeight)
decisionTreeImgStyle = "position: absolute; height: %spx; width: %spx; padding: %spx %spx;" % (
mapImgHeight, mapImgWidth, mapImgVPad, mapImgHPad)
decisionTreeSummaryDivStyle = "position: relative; top: -1315px; left: 8px; width: 600px; background-color: pink; border-radius: 8px; display: flex;" + \
("height: %spx" % (200+dirImgHeight))
soilMoistImgStyle = None
if soilMoistImg == unavailableImg:
soilMoistImgStyle = unavailableImgDecisionStyle + \
("margin-left: -%spx" % (mapInnerPadH))
rviImgStyle = None
if rviImg == unavailableImg:
rviImgStyle = unavailableImgDecisionStyle + \
("margin-left: -%spx" % (mapInnerPadH))
mapImgHeight2 = 320 if mapImgRatio > 0.92 else 347.825*mapImgRatio
mapImgWidth2 = mapImgHeight2/mapImgRatio
mapImgHPad2 = mapImgWidth2*fieldImgPaddings[0]/(fieldImgPaddings[0]*2+1)
mapImgVPad2 = mapImgHeight2*fieldImgPaddings[1]/(fieldImgPaddings[1]*2+1)
decisionTreeFieldDirImgStyle2 = "height: %spx; width: %spx; padding: %spx %spx;" % (
mapImgHeight2, mapImgWidth2, mapImgVPad2, mapImgHPad2)
satImgStyle = "margin-top: 16px;" + \
("height: 250px; width: auto;" if mapImgRatio >
0.658 else "height: auto; width: 380px")
fieldAreaValueH6 = fieldAreaValue+" sq m (approx.)"
latValueH6 = latitudeTxt+latValue
longValueH6 = longitudeTxt+longValue
decisionTreeETCIImg = rgbETCIImg
decisionTreeRVIImg = rviImg
decisionTreeSoilMoistImg = soilMoistImg
decisionTreeNDVIImg = ndviGoodHeightImg
decisionTreeNDREImg = ndreGoodHeightImg
decisionTreeNDWIImg = ndwiGoodHeightImg
decisionTreeCompassImg = "report_images/compass/%s.jpg" % (
langCode if langCode != "mr" else "hi")
# decisionTreeRVIScaleImg = "report_images/ndvi_scale.jpg"
# decisionTreeSoilMoistScaleImg = "report_images/ndvi_scale.jpg"
# if langCode == "hi":
# decisionTreeBasicScaleImg = "report_images/hybrid_scale_hindi.jpg"
# elif langCode == "mr":
# decisionTreeBasicScaleImg = "report_images/hybrid_scale_marathi.jpg"
# elif langCode == "te":
# decisionTreeBasicScaleImg = "report_images/hybrid_scale_telugu.jpg"
# elif langCode == "ta":
# decisionTreeBasicScaleImg = "report_images/hybrid_scale_tamil.jpg"
# elif langCode == "kn":
# decisionTreeBasicScaleImg = "report_images/hybrid_scale_kannada.jpg"
# elif langCode == "bn":
# decisionTreeBasicScaleImg = "report_images/hybrid_scale_bengali.jpg"
# else:
# decisionTreeBasicScaleImg = "report_images/hybrid_scale_english.jpg"
# # decisionTreeNDVIScaleImg = "report_images/ndvi_scale.jpg"
# decisionTreeNDREScaleImg = "report_images/ndvi_scale.jpg"
# decisionTreeNDWIScaleImg = "report_images/ndvi_scale.jpg"
decisionTreeHeadingDiv = indexTitle1Td
# weather
weatherHeadingDiv = indexTitle2Td
weatherValueStnH1 = weatherValueStn
weatherValueCloudH2 = weatherValueCloud+" %"
weatherValueTempMinH2 = weatherValueTempMin+" deg C"
weatherValueTempMaxH2 = weatherValueTempMax+" deg C"
weatherValueWindH2 = weatherValueWind+" m/s"
weatherValueWindDirH2 = weatherValueWindDir+" deg"
weatherValueHumidityH2 = weatherValueHumidity+" %"
weatherValuePressureH2 = weatherValuePressure+" hPa"
# weatherGraphCloudImg = "report_images/weatherGraph.JPG"
# weatherGraphHumidityImg = "report_images/weatherGraph.JPG"
# weatherGraphPressureImg = "report_images/weatherGraph.JPG"
# weatherGraphWindImg = "report_images/weatherGraph.JPG"
# ndvi
cropHealthHeadingDiv = indexTitle8Td
ndviSubHeadingDiv = indexTitle9Td
ndviScientificH2 = scientifiyBackgroundTxt
# ndviScaleImg = "report_images/weatherGraph.JPG"
ndviGoodHeightH3 = goodHeightCondTxt
# ndviGoodHeightScaleImg = "report_images/weatherGraph.JPG"
# ndviSmallHeightScaleImg = "report_images/weatherGraph.JPG"
ndviSmallHeightH3 = smallHeightCondTxt
# rgb
# color-blind
# colorBlindScaleImg = "report_images/weatherGraph.JPG"
# rvi
radarHeadingDiv = indexTitle7Td
rviSubHeadingDiv = indexTitle7_3Td
rviScientificH2 = scientifiyBackgroundTxt
# rviScaleImg = "report_images/weatherGraph.JPG"
# soil moisture
soilMoistSubHeadingDiv = indexTitle7_6Td
soilMoistScientificH2 = scientifiyBackgroundTxt
# soilMoistScaleImg = "report_images/weatherGraph.JPG"
# evi
eviSubHeadingDiv = indexTitle10Td
eviScientificH2 = scientifiyBackgroundTxt
# eviScaleImg = "report_images/weatherGraph.JPG"
eviGoodHeightH3 = goodHeightCondTxt
# eviGoodHeightScaleImg = "report_images/weatherGraph.JPG"
# eviSmallHeightScaleImg = "report_images/weatherGraph.JPG"
eviSmallHeightH3 = smallHeightCondTxt
# savi
saviSubHeadingDiv = indexTitle11Td
saviScientificH2 = scientifiyBackgroundTxt
# saviScaleImg = "report_images/weatherGraph.JPG"
saviGoodHeightH3 = goodHeightCondTxt
# saviGoodHeightScaleImg = "report_images/weatherGraph.JPG"
# saviSmallHeightScaleImg = "report_images/weatherGraph.JPG"
saviSmallHeightH3 = smallHeightCondTxt
# ndre
ndreScientificH2 = scientifiyBackgroundTxt
# ndreScaleImg = "report_images/weatherGraph.JPG"
ndreGoodHeightH3 = goodHeightCondTxt
# ndreGoodHeightScaleImg = "report_images/weatherGraph.JPG"
# ndreSmallHeightScaleImg = "report_images/weatherGraph.JPG"
ndreSmallHeightH3 = smallHeightCondTxt
# ndwi
waterHealthHeadingDiv = indexTitle13Td
ndwiSubHeadingDiv = indexTitle14Td
ndwiScientificH2 = scientifiyBackgroundTxt
# ndwiScaleImg = "report_images/weatherGraph.JPG"
ndwiGoodHeightH3 = goodHeightCondTxt
# ndwiGoodHeightScaleImg = "report_images/weatherGraph.JPG"
# ndwiSmallHeightScaleImg = "report_images/weatherGraph.JPG"
ndwiSmallHeightH3 = smallHeightCondTxt
# ndmi
ndmiSubHeadingDiv = indexTitle15Td
ndmiScientificH2 = scientifiyBackgroundTxt
# ndmiScaleImg = "report_images/weatherGraph.JPG"
ndmiGoodHeightH3 = goodHeightCondTxt
# ndmiGoodHeightScaleImg = "report_images/weatherGraph.JPG"
# ndmiSmallHeightScaleImg = "report_images/weatherGraph.JPG"
ndmiSmallHeightH3 = smallHeightCondTxt
# evapo
evapoSubHeadingDiv = indexTitle16Td
# evapoScaleImg = "report_images/weatherGraph.JPG"
# soil
soilSubHeadingDiv = indexTitle9Td
# soilScaleImg = "report_images/weatherGraph.JPG"
soilGoodHeightH3 = goodHeightCondTxt
# soilGoodHeightScaleImg = "report_images/weatherGraph.JPG"
# soilSmallHeightScaleImg = "report_images/weatherGraph.JPG"
soilSmallHeightH3 = smallHeightCondTxt
# others
thanksH1 = "KEEP MONITORING FARMS"
page1P = "page 1"
page2P = "page 2"
page3P = "page 3"
page4P = "page 4"
page5P = "page 5"
page6P = "page 6"
page7P = "page 7"
page8P = "page 8"
page9P = "page 9"
page10P = "page 10"
page11P = "page 11"
page12P = "page 12"
page13P = "page 13"
# REPLACE DATA; make sure to call the function in order of html code
# replacing comments
# htmlStr = replaceHtmlComments(htmlStr)
# page 1 - intro
# print(initialIndex, htmlStr)
htmlStr, initialIndex = replaceHtmlStyle(
"@font-face", fontStyle, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlStyle(
"*", allEleStyle, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlStyle(
".decision_tree_img_inner_div", decisionTreeImgInnerDivStyle, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlStyle(
".decision_tree_sat_back_img", decisionTreeMapImgStyle, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlStyle(
".decision_tree_sat_img", decisionTreeImgStyle, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlStyle(
".sat_img", satImgStyle, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlStyle(
".non_rvi_only", nonRVIOnlyStyle, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlStyle(
".rvi_only", rviOnlyStyle, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlEleStyle(
"companyLogoDiv", companyLogoDivStyle, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
"companyLogoImg", companyLogoImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
"fieldReportHeadingDiv", fieldReportHeadingDiv, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlEleStyle(
"reportInfoP", introPStyle, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'reportInfoP', reportInfoP, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'generationDateTitleH6', generationDateTitleH6, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'generationDateValueH6', generationDateValueH6, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'visitDateTitleH6', visitDateTitleH6, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'visitDateValueH6', visitDateValueH6, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'fieldDetailsHeadingDiv', fieldDetailsHeadingDiv, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'addressTitleH6', addressTitleH6, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'addressValueH6', addressValueH6, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'fieldAreaTitleH6', fieldAreaTitleH6, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'fieldAreaValueH6', fieldAreaValueH6, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'locationTitleH6', locationTitleH6, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'latValueH6', latValueH6, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'longValueH6', longValueH6, htmlStr, initialIndex)
# index table
htmlStr, initialIndex = replaceHtmlData(
'indexHeadingDiv', indexHeadingDiv, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexSerialTh', indexSerialTh, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitleTh', indexTitleTh, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexPageTh', indexPageTh, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitle1Td', indexTitle1Td, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitle2Td', indexTitle2Td, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitle3Td', indexTitle3Td, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitle4Td', indexTitle4Td, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitle5Td', indexTitle5Td, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitle6Td', indexTitle6Td, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitle7Td', indexTitle7Td, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitle7_3Td', indexTitle7_3Td, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitle7_6Td', indexTitle7_6Td, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitle8Td', indexTitle8Td, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitle9Td', indexTitle9Td, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitle10Td', indexTitle10Td, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitle11Td', indexTitle11Td, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitle12Td', indexTitle12Td, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitle13Td', indexTitle13Td, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitle14Td', indexTitle14Td, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitle15Td', indexTitle15Td, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitle16Td', indexTitle16Td, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitle17Td', indexTitle17Td, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexSerialTh', indexSerialTh, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitleTh', indexTitleTh, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexPageTh', indexPageTh, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitle1Td', indexTitle1Td, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitle2Td', indexTitle2Td, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitle3Td', indexTitle3Td, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitle4Td', indexTitle4Td, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitle7Td', indexTitle7Td, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitle7_3Td', indexTitle7_3Td, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'indexTitle7_6Td', indexTitle7_6Td, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'page1P', page1P, htmlStr, initialIndex)
# page 2 - decision tree
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeHeadingDiv', decisionTreeHeadingDiv, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeETCIH3', decisionTreeETCIH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'decisionTreeETCISatImg', mapImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'decisionTreeETCIImg', decisionTreeETCIImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeCloudyCondH4', decisionTreeCloudyCondH4, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeCloudyCondH5', decisionTreeCloudyCondH5, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeNDVICondH4', decisionTreeNDVICondH4, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeNDRECondH4', decisionTreeNDRECondH4, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeRVIH3', decisionTreeRVIH3, htmlStr, initialIndex)
if rviImgStyle != None: # img not present
htmlStr, initialIndex = replaceHtmlEleStyle(
'decisionTreeRVISatImg', displayNoneStyle, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlEleStyle(
'decisionTreeRVIImg', rviImgStyle, htmlStr, initialIndex)
else:
htmlStr, initialIndex = replaceHtmlImgSrc(
'decisionTreeRVISatImg', mapImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'decisionTreeRVIImg', decisionTreeRVIImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('decisionTreeRVIScaleImg', decisionTreeRVIScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeSoilMoistH3', decisionTreeSoilMoistH3, htmlStr, initialIndex)
if soilMoistImgStyle != None:
htmlStr, initialIndex = replaceHtmlEleStyle(
'decisionTreeSoilMoistSatImg', displayNoneStyle, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlEleStyle(
'decisionTreeSoilMoistImg', soilMoistImgStyle, htmlStr, initialIndex)
else:
htmlStr, initialIndex = replaceHtmlImgSrc(
'decisionTreeSoilMoistSatImg', mapImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'decisionTreeSoilMoistImg', decisionTreeSoilMoistImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('decisionTreeSoilMoistScaleImg', decisionTreeSoilMoistScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeNDVIH3', decisionTreeNDVIH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'decisionTreeNDVISatImg', mapImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'decisionTreeNDVIImg', decisionTreeNDVIImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('decisionTreeNDVIScaleImg', decisionTreeNDVIScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeNDREH3', decisionTreeNDREH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'decisionTreeNDRESatImg', mapImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'decisionTreeNDREImg', decisionTreeNDREImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('decisionTreeNDREScaleImg', decisionTreeNDREScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeNDWIH3', decisionTreeNDWIH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'decisionTreeNDWISatImg', mapImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'decisionTreeNDWIImg', decisionTreeNDWIImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('decisionTreeNDWIScaleImg', decisionTreeNDWIScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeBasicH3', decisionTreeBasicH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'decisionTreeBasicSatImg', mapImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'decisionTreeBasicImg', decisionTreeBasicImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('decisionTreeBasicScaleImg', decisionTreeBasicScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlEleStyle(
'decisionTreeSummaryDiv', decisionTreeSummaryDivStyle, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeSummaryTitleH3', decisionTreeSummaryTitleH3, htmlStr, initialIndex)
if soilMoistImgStyle != None:
htmlStr, initialIndex = replaceHtmlEleStyle(
'decisionTreeSummaryCloudyDiv', displayNoneStyle, htmlStr, initialIndex)
else:
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeCloudyTitleH3', decisionTreeCloudyTitleH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeCloudyIrriP', decisionTreeCloudyIrriP, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeCloudyCropP', decisionTreeCloudyCropP, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeEarlyTitleH3', decisionTreeEarlyTitleH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeEarlyIrriP', decisionTreeEarlyIrriP, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeEarlyCropP', decisionTreeEarlyCropP, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeLaterTitleH3', decisionTreeLaterTitleH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeLaterIrriP', decisionTreeLaterIrriP, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeLaterCropP', decisionTreeLaterCropP, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'decisionTreeCompassImg', decisionTreeCompassImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlEleStyle(
'decisionTreeFieldDirImg', decisionTreeFieldDirImgStyle, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'decisionTreeFieldDirImg', decisionTreeFieldDirImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'page2P', page2P, htmlStr, initialIndex)
# page 2 rvi_only
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeHeadingDiv', decisionTreeHeadingDiv, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeETCIH3', decisionTreeETCIH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'decisionTreeETCISatImg', mapImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'decisionTreeETCIImg', decisionTreeETCIImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeCloudyCondH4', decisionTreeCloudyCondH4, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeCloudyCondH5', decisionTreeCloudyCondH5, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeRVIH3', decisionTreeRVIH3, htmlStr, initialIndex)
if rviImgStyle != None: # img not present
htmlStr, initialIndex = replaceHtmlEleStyle(
'decisionTreeRVISatImg', displayNoneStyle, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlEleStyle(
'decisionTreeRVIImg', rviImgStyle, htmlStr, initialIndex)
else:
htmlStr, initialIndex = replaceHtmlImgSrc(
'decisionTreeRVISatImg', mapImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'decisionTreeRVIImg', decisionTreeRVIImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('decisionTreeRVIScaleImg', decisionTreeRVIScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeSoilMoistH3', decisionTreeSoilMoistH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'decisionTreeSoilMoistSatImg', mapImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'decisionTreeSoilMoistImg', decisionTreeSoilMoistImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('decisionTreeSoilMoistScaleImg', decisionTreeSoilMoistScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'decisionTreeCompassImg', decisionTreeCompassImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlEleStyle(
'decisionTreeFieldDirImg', decisionTreeFieldDirImgStyle2, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'decisionTreeFieldDirImg', decisionTreeFieldDirImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeSummaryTitleH3', decisionTreeSummaryTitleH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeCloudyTitleH3', decisionTreeCloudyTitleH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeCloudyIrriP', decisionTreeCloudyIrriP, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'decisionTreeCloudyCropP', decisionTreeCloudyCropP, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'page2P', page2P, htmlStr, initialIndex)
# page 3 - weather
htmlStr, initialIndex = replaceHtmlData(
'weatherHeadingDiv', weatherHeadingDiv, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weatherTitleStnH3', weatherTitleStnH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weatherValueStnH1', weatherValueStnH1, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weatherTitleCloudH4', weatherTitleCloudH4, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weatherValueCloudH2', weatherValueCloudH2, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weatherTitleTempMinH4', weatherTitleTempMinH4, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weatherValueTempMinH2', weatherValueTempMinH2, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weatherTitleWindH4', weatherTitleWindH4, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weatherValueWindH2', weatherValueWindH2, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weatherTitleHumidityH4', weatherTitleHumidityH4, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weatherValueHumidityH2', weatherValueHumidityH2, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weatherTitleTempMaxH4', weatherTitleTempMaxH4, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weatherValueTempMaxH2', weatherValueTempMaxH2, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weatherTitleWindDirH4', weatherTitleWindDirH4, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weatherValueWindDirH2', weatherValueWindDirH2, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weatherTitlePressureH4', weatherTitlePressureH4, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weatherValuePressureH2', weatherValuePressureH2, htmlStr, initialIndex)
# weather forcast table
htmlStr, initialIndex = replaceHtmlData(
'forcastHeadingDiv', forcastHeadingDiv, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weatherDateThH4', weatherDateThH4, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weatherSummaryThH4', weatherSummaryThH4, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weatherMinTempThH4', weatherMinTempThH4, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weatherMaxTempThH4', weatherMaxTempThH4, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weatherRainThH4', weatherRainThH4, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weatherMaxPrecipitationThH4', weatherMaxPrecipitationThH4, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weatherCloudCoverThH4', weatherCloudCoverThH4, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather1DateTd', weather1DateTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather1SummaryTd', weather1SummaryTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather1MinTempTd', weather1MinTempTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather1MaxTempTd', weather1MaxTempTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather1RainTd', weather1RainTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather1MaxPrecipitationTd', weather1MaxPrecipitationTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather1CloudCoverTd', weather1CloudCoverTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather2DateTd', weather2DateTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather2SummaryTd', weather2SummaryTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather2MinTempTd', weather2MinTempTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather2MaxTempTd', weather2MaxTempTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather2RainTd', weather2RainTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather2MaxPrecipitationTd', weather2MaxPrecipitationTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather2CloudCoverTd', weather2CloudCoverTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather3DateTd', weather3DateTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather3SummaryTd', weather3SummaryTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather3MinTempTd', weather3MinTempTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather3MaxTempTd', weather3MaxTempTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather3RainTd', weather3RainTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather3MaxPrecipitationTd', weather3MaxPrecipitationTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather3CloudCoverTd', weather3CloudCoverTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather4DateTd', weather4DateTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather4SummaryTd', weather4SummaryTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather4MinTempTd', weather4MinTempTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather4MaxTempTd', weather4MaxTempTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather4RainTd', weather4RainTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather4MaxPrecipitationTd', weather4MaxPrecipitationTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather4CloudCoverTd', weather4CloudCoverTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather5DateTd', weather5DateTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather5SummaryTd', weather5SummaryTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather5MinTempTd', weather5MinTempTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather5MaxTempTd', weather5MaxTempTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather5RainTd', weather5RainTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather5MaxPrecipitationTd', weather5MaxPrecipitationTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather5CloudCoverTd', weather5CloudCoverTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather6DateTd', weather6DateTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather6SummaryTd', weather6SummaryTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather6MinTempTd', weather6MinTempTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather6MaxTempTd', weather6MaxTempTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather6RainTd', weather6RainTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather6MaxPrecipitationTd', weather6MaxPrecipitationTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather6CloudCoverTd', weather6CloudCoverTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather7DateTd', weather7DateTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather7SummaryTd', weather7SummaryTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather7MinTempTd', weather7MinTempTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather7MaxTempTd', weather7MaxTempTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather7RainTd', weather7RainTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather7MaxPrecipitationTd', weather7MaxPrecipitationTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'weather7CloudCoverTd', weather7CloudCoverTd, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'page3P', page3P, htmlStr, initialIndex)
# page 4 - weather
htmlStr, initialIndex = replaceHtmlData(
'weatherGraphHeadingDiv', weatherGraphHeadingDiv, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'weatherGraphImg', weatherGraphImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('weatherGraphCloudImg', weatherGraphCloudImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('weatherGraphHumidityImg', weatherGraphHumidityImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('weatherGraphPressureImg', weatherGraphPressureImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('weatherGraphWindImg', weatherGraphWindImg, htmlStr, initialIndex)
# rgb
htmlStr, initialIndex = replaceHtmlData(
'rgbHeadingDiv', rgbHeadingDiv, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'rgbInfoP', rgbInfoP, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'rgbTCIImg', rgbTCIImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'rgbETCIImg', rgbETCIImg, htmlStr, initialIndex)
# color-blind
htmlStr, initialIndex = replaceHtmlEleStyle(
'colorBlindHeadingDiv', colorBlindHeadingStyle, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'colorBlindHeadingDiv', colorBlindHeadingDiv, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'colorBlindImg', colorBlindImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('colorBlindScaleImg', colorBlindScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'page4P', page4P, htmlStr, initialIndex)
# page 5 - radar
htmlStr, initialIndex = replaceHtmlData(
'radarHeadingDiv', radarHeadingDiv, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'rviSubHeadingDiv', rviSubHeadingDiv, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'rviImg', rviImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('rviScaleImg', rviScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'rviScientificH2', rviScientificH2, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'rviScientificP', rviScientificP, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'soilMoistSubHeadingDiv', soilMoistSubHeadingDiv, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'soilMoistImg', soilMoistImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('soilMoistScaleImg', soilMoistScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'soilMoistScientificH2', soilMoistScientificH2, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'soilMoistScientificP', soilMoistScientificP, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'thanksH1', thanksH1, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'page5P', page5P, htmlStr, initialIndex)
# page 6 - ndvi
htmlStr, initialIndex = replaceHtmlData(
'cropHealthHeadingDiv', cropHealthHeadingDiv, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'ndviSubHeadingDiv', ndviSubHeadingDiv, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'ndviInfoP', ndviInfoP, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'ndviGoodHeightH3', ndviGoodHeightH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'ndviGoodHeightImg', ndviGoodHeightImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('ndviGoodHeightScaleImg', ndviGoodHeightScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'ndviSmallHeightH3', ndviSmallHeightH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'ndviSmallHeightImg', ndviSmallHeightImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('ndviSmallHeightScaleImg', ndviSmallHeightScaleImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('ndviScaleImg', ndviScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'ndviIndexImg', ndviIndexImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'ndviGraphImg', ndviGraphImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'ndviScientificH2', ndviScientificH2, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'ndviScientificP', ndviScientificP, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'page6P', page6P, htmlStr, initialIndex)
# page 7 - evi
htmlStr, initialIndex = replaceHtmlData(
'eviSubHeadingDiv', eviSubHeadingDiv, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'eviInfoP', eviInfoP, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'eviGoodHeightH3', eviGoodHeightH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'eviGoodHeightImg', eviGoodHeightImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('eviGoodHeightScaleImg', eviGoodHeightScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'eviSmallHeightH3', eviSmallHeightH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'eviSmallHeightImg', eviSmallHeightImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('eviSmallHeightScaleImg', eviSmallHeightScaleImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('eviScaleImg', eviScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'eviIndexImg', eviIndexImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'eviGraphImg', eviGraphImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'eviScientificH2', eviScientificH2, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'eviScientificP', eviScientificP, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'page7P', page7P, htmlStr, initialIndex)
# page 8 - savi
htmlStr, initialIndex = replaceHtmlData(
'saviSubHeadingDiv', saviSubHeadingDiv, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'saviInfoP', saviInfoP, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'saviGoodHeightH3', saviGoodHeightH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'saviGoodHeightImg', saviGoodHeightImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('saviGoodHeightScaleImg', saviGoodHeightScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'saviSmallHeightH3', saviSmallHeightH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'saviSmallHeightImg', saviSmallHeightImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('saviSmallHeightScaleImg', saviSmallHeightScaleImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('saviScaleImg', saviScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'saviIndexImg', saviIndexImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'saviGraphImg', saviGraphImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'saviScientificH2', saviScientificH2, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'saviScientificP', saviScientificP, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'page8P', page8P, htmlStr, initialIndex)
# page 9 - ndre
htmlStr, initialIndex = replaceHtmlData(
'ndreSubHeadingDiv', ndreSubHeadingDiv, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'ndreInfoP', ndreInfoP, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'ndreGoodHeightH3', ndreGoodHeightH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'ndreGoodHeightImg', ndreGoodHeightImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('ndreGoodHeightScaleImg', ndreGoodHeightScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'ndreSmallHeightH3', ndreSmallHeightH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'ndreSmallHeightImg', ndreSmallHeightImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('ndreSmallHeightScaleImg', ndreSmallHeightScaleImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('ndreScaleImg', ndreScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'ndreIndexImg', ndreIndexImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'ndreGraphImg', ndreGraphImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'ndreScientificH2', ndreScientificH2, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'ndreScientificP', ndreScientificP, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'page9P', page9P, htmlStr, initialIndex)
# page 10 - ndwi
htmlStr, initialIndex = replaceHtmlData(
'waterHealthHeadingDiv', waterHealthHeadingDiv, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'ndwiSubHeadingDiv', ndwiSubHeadingDiv, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'ndwiInfoP', ndwiInfoP, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'ndwiGoodHeightH3', ndwiGoodHeightH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'ndwiGoodHeightImg', ndwiGoodHeightImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('ndwiGoodHeightScaleImg', ndwiGoodHeightScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'ndwiSmallHeightH3', ndwiSmallHeightH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'ndwiSmallHeightImg', ndwiSmallHeightImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('ndwiSmallHeightScaleImg', ndwiSmallHeightScaleImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('ndwiScaleImg', ndwiScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'ndwiIndexImg', ndwiIndexImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'ndwiGraphImg', ndwiGraphImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'ndwiScientificH2', ndwiScientificH2, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'ndwiScientificP', ndwiScientificP, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'page10P', page10P, htmlStr, initialIndex)
# page 11 - ndmi
htmlStr, initialIndex = replaceHtmlData(
'ndmiSubHeadingDiv', ndmiSubHeadingDiv, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'ndmiInfoP', ndmiInfoP, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'ndmiGoodHeightH3', ndmiGoodHeightH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'ndmiGoodHeightImg', ndmiGoodHeightImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('ndmiGoodHeightScaleImg', ndmiGoodHeightScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'ndmiSmallHeightH3', ndmiSmallHeightH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'ndmiSmallHeightImg', ndmiSmallHeightImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('ndmiSmallHeightScaleImg', ndmiSmallHeightScaleImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('ndmiScaleImg', ndmiScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'ndmiIndexImg', ndmiIndexImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'ndmiGraphImg', ndmiGraphImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'ndmiScientificH2', ndmiScientificH2, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'ndmiScientificP', ndmiScientificP, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'page11P', page11P, htmlStr, initialIndex)
# page 12 - evapo, soil
htmlStr, initialIndex = replaceHtmlData(
'evapoSubHeadingDiv', evapoSubHeadingDiv, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'evapoImg', evapoImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('evapoScaleImg', evapoScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'evapoH4', evapoH4, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'evapoInfoP', evapoInfoP, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'soilHealthHeadingDiv', soilHealthHeadingDiv, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'soilSubHeadingDiv', soilSubHeadingDiv, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'soilInfoP', soilInfoP, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'soilGoodHeightH3', soilGoodHeightH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'soilGoodHeightImg', socGoodHeightImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('soilGoodHeightScaleImg', soilGoodHeightScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'soilSmallHeightH3', soilSmallHeightH3, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'soilSmallHeightImg', socSmallHeightImg, htmlStr, initialIndex)
# htmlStr, initialIndex = replaceHtmlImgSrc('soilSmallHeightScaleImg', soilSmallHeightScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'page12P', page12P, htmlStr, initialIndex)
# page 13 - thanks
# htmlStr, initialIndex = replaceHtmlImgSrc('soilScaleImg', soilScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'soilIndexImg', socIndexImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlImgSrc(
'soilGraphImg', socGraphImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'thanksH1', thanksH1, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
'page13P', page13P, htmlStr, initialIndex)
return htmlStr
# run commands
# removeKeysInTranslation(["bn", "mr", "te", "ta", "kn", "ar", "en", "hi", "uz"], ['weatherHeadingDiv', 'decisionTreeHeadingDiv'])
# createTranslationJson(["bn", "mr", "te", "ta", "kn", "ar", "en", "hi", "uz"])
# openFile()
# time.sleep(1)
# "bn", "mr", "te", "ta", "kn", "ar", "en", "hi", "uz"
# langs = ["bn", "mr", "te", "ta", "kn", "ar", "en", "hi", "uz"]
# for langCode in langs:
# langCode = "hi"
# populatedString = populateData(langCode, None, allReportTestValues, True)
# # # print(populatedString)
# saveToTmpHtml(populatedString)
# # openFile(file=tmpFileName)
# createPdf(file=tmpFileName,
# outfile="out_{langCode}.pdf".format(langCode=langCode))
# print(langCode + " done")
# createPdfByString(populateData)
# p = multiprocessing.Process(target = createPdf, args = ()) # Create the process
# p.start() # Start the process
# p.join(5) # Give it a 180 sec frame to complete before you kill it
# if p.is_alive():
# p.terminate() # If after 180 sec its still running, kill it
# from wkhtmltopdf import HTMLFILEToPDF
# make_pdf = wkhtmltopdf.HTMLFILEToPDF(
# url=fileName,
# output_file='~/out.pdf',
# )
# make_pdf.render()