import os
import re
import webbrowser
import pdfkit
import time
import multiprocessing
import json
from PIL import Image
from create_instructions import getRedZones, getFullInstructions
# from gen_report_new2 import createShortDynamicLink
# from pyvirtualdisplay import Display
fieldColorImg = "report_images/reportPics/sat_img_etci.png"
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',
}
allReportTestValues = {
"isCloudy": "False",
"isOilPalm": "False",
"isSmallPlant": "False",
"isPolygon": "False",
"mapImgSize": "(20, 10)",
"fieldImgPaddings": "(0.1, 0.1)",
"mapImg": "report_images/fieldMap.jpg",
"fieldBdyImg": "report_images/fieldMap.jpg",
"decisionTreeFieldDirImg": "report_images/demoPics/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",
"demGoodHeightImg": fieldColorImg,
"socIndexImg": fieldColorImg,
"socGraphImg": fieldColorImg,
"socGoodHeightImg": fieldColorImg,
"socSmallHeightImg": fieldColorImg,
"ndviIndexImg": fieldColorImg,
"ndviGraphImg": fieldColorImg,
"ndviGoodHeightImg": fieldColorImg,
"ndviSmallHeightImg": fieldColorImg,
"ndwiIndexImg": fieldColorImg,
"ndwiGraphImg": fieldColorImg,
"ndwiGoodHeightImg": fieldColorImg,
"ndwiSmallHeightImg": fieldColorImg,
"ndmiIndexImg": fieldColorImg,
"ndmiGraphImg": fieldColorImg,
"ndmiGoodHeightImg": fieldColorImg,
"ndmiSmallHeightImg": fieldColorImg,
"saviIndexImg": fieldColorImg,
"saviGraphImg": fieldColorImg,
"saviGoodHeightImg": fieldColorImg,
"saviSmallHeightImg": fieldColorImg,
"eviIndexImg": fieldColorImg,
"eviGraphImg": fieldColorImg,
"eviGoodHeightImg": fieldColorImg,
"eviSmallHeightImg": fieldColorImg,
"ndreIndexImg": fieldColorImg,
"ndreGraphImg": fieldColorImg,
"ndreGoodHeightImg": fieldColorImg,
"ndreSmallHeightImg": fieldColorImg,
"reclGoodHeightImg": fieldColorImg,
"reclSmallHeightImg": fieldColorImg,
"rgbTCIImg": fieldColorImg,
"rgbETCIImg": fieldColorImg,
"soilMoistImg": fieldColorImg,
"evapoImg": fieldColorImg,
# "rviImg": fieldColorImg,
"colorBlindImg": fieldColorImg,
"decisionTreeBasicImg": fieldColorImg,
"weatherGraphImg": fieldColorImg,
}
fileName = "report_template.html"
tmpFileName = "report_tmp.html"
# functions
def createExtractTranslationTxt(langCode="en", outFile="tmpTxtFile.txt"):
translations = None
fileName = "jsons/app_{langCode}.json".format(langCode=langCode)
with open(fileName, encoding="utf8") as f:
jsonStr = f.read()
translations = json.loads(jsonStr) # expects a dictionary
resultStr = ""
for key in translations.keys():
resultStr += (
"%s = translations.get('%s', None) or enTrans.get('%s', None)\n"
% (key, key, key)
)
with open(outFile, "w", encoding="utf8") as f:
f.write(resultStr)
def createTranslationJson(langs, outFile="uploadTrans.json"):
allTransObj = {}
for langCode in langs:
translations = None
fileName = "jsons/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 = "jsons/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=fileName):
pdfFileName = outfile or "out.pdf"
path_wkhtmltopdf = r"C:\Program Files\wkhtmltopdf\bin\wkhtmltopdf.exe"
c = pdfkit.configuration(wkhtmltopdf=path_wkhtmltopdf)
# absPath = os.path.abspath(fileName)
pdfkit.from_file(file, pdfFileName, options, configuration=c)
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, 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(
"jsons/app_{langCode}.json".format(langCode=langCode), encoding="utf8"
) as f:
jsonStr = f.read()
translations = json.loads(jsonStr) # expects a dictionary
with open("jsons/app_en.json", encoding="utf8") as f:
jsonStr = f.read()
enTrans = json.loads(jsonStr) # expects
# get data to replace
if langCode in ["uz"]:
introPStyle = "font-size: 16px;"
companyLogoDivStyle = "height: 100px; padding-bottom: 16px; text-align: center;"
else:
introPStyle = "font-size: 18px;"
companyLogoDivStyle = "height: 130px; padding-bottom: 16px; text-align: center;"
if langCode in ["uz", "ta"]:
colorBlindHeadingStyle = "margin-top: 8px; font-size: 20px;"
else:
colorBlindHeadingStyle = "margin-top: 8px;"
if langCode not in ["uz", "bn"]:
unavailableImg = f"https://farmonaut.com/Images/unavailable_{langCode}.jpg"
else:
unavailableImg = "https://farmonaut.com/Images/unavailable.jpg"
if langCode == "pa":
fontStyle = "font-family: MuktaMahee; src: url('report_fonts/Mukta_Mahee/MuktaMahee-Light.ttf') format('truetype');"
allEleStyle = "box-sizing: border-box; font-family: MuktaMahee;"
allTextStyle = "line-height: 1.6; margin: 0;"
elif 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;"
allTextStyle = "line-height: 1.8; margin: 0;"
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;"
allTextStyle = "line-height: 1.3; margin: 0;"
elif 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;"
allTextStyle = "line-height: 1.6; margin: 0;"
elif langCode == "gu":
fontStyle = "font-family: HindVadodara; src: url('report_fonts/Hind_Vadodara/HindVadodara-Light.ttf') format('truetype');"
allEleStyle = "box-sizing: border-box; font-family: HindVadodara;"
allTextStyle = "line-height: 1.6; margin: 0;"
elif langCode == "or":
fontStyle = "font-family: NotoSansOriya; src: url('report_fonts/Noto_Sans_Oriya/static/NotoSansOriya-Light.ttf') format('truetype');"
allEleStyle = "box-sizing: border-box; font-family: NotoSansOriya;"
allTextStyle = "line-height: 1.6; margin: 0;"
elif langCode == "ml":
fontStyle = "font-family: NotoSansMalayalam; src: url('report_fonts/Noto_Sans_Malayalam/static/NotoSansMalayalam_ExtraCondensed-Light.ttf') format('truetype');"
allEleStyle = "box-sizing: border-box; font-family: NotoSansMalayalam;"
allTextStyle = "line-height: 1.6; margin: 0;"
elif 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;"
allTextStyle = "line-height: 1.6; margin: 0;"
elif langCode == "uz":
fontStyle = "font-family: NotoSans; src: url('report_fonts/Noto_Sans/NotoSans-Light.ttf') format('truetype');"
allEleStyle = "box-sizing: border-box; font-family: NotoSans;"
allTextStyle = "line-height: 1.5; margin: 0;"
else:
fontStyle = "font-family: NotoSans; src: url('report_fonts/Noto_Sans/NotoSans-Light.ttf') format('truetype');"
allEleStyle = "box-sizing: border-box; font-family: NotoSans;"
allTextStyle = "line-height: 1.8; margin: 0;"
defaultValues = {
"isCloudy": False,
"isOilPalm": False,
"isSmallPlant": False,
"isPolygon": False,
"mapImgSize": None,
"fieldImgPaddings": (0, 0),
"mapImg": "",
"fieldBdyImg": "",
"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",
"demGoodHeightImg": unavailableImg,
"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,
"reclGoodHeightImg": unavailableImg,
"reclSmallHeightImg": unavailableImg,
"rgbTCIImg": unavailableImg,
"rgbETCIImg": unavailableImg,
"soilMoistImg": unavailableImg,
"evapoImg": unavailableImg,
"rviImg": unavailableImg,
"colorBlindImg": unavailableImg,
"decisionTreeBasicImg": unavailableImg,
"weatherGraphImg": unavailableImg,
}
# translation txts
decisionTreeSummaryTitleH3 = translations.get(
"decisionTreeSummaryTitleH3", None
) or enTrans.get("decisionTreeSummaryTitleH3", None)
decisionTreeScaleH3 = translations.get("decisionTreeScaleH3", None) or enTrans.get(
"decisionTreeScaleH3", None
)
decisionTreeCloudyTitleH3 = translations.get(
"decisionTreeCloudyTitleH3", None
) or enTrans.get("decisionTreeCloudyTitleH3", None)
decisionTreeEarlyTitleH3 = translations.get(
"decisionTreeEarlyTitleH3", None
) or enTrans.get("decisionTreeEarlyTitleH3", None)
decisionTreeLaterTitleH3 = translations.get(
"decisionTreeLaterTitleH3", None
) or enTrans.get("decisionTreeLaterTitleH3", None)
fieldReportHeadingDiv = translations.get(
"fieldReportHeadingDiv", None
) or enTrans.get("fieldReportHeadingDiv", None)
reportInfoP = translations.get("reportInfoP", None) or enTrans.get(
"reportInfoP", None
)
generationDateTitleH6 = translations.get(
"generationDateTitleH6", None
) or enTrans.get("generationDateTitleH6", None)
visitDateTitleH6 = translations.get("visitDateTitleH6", None) or enTrans.get(
"visitDateTitleH6", None
)
fieldDetailsHeadingDiv = translations.get(
"fieldDetailsHeadingDiv", None
) or enTrans.get("fieldDetailsHeadingDiv", None)
addressTitleH6 = translations.get("addressTitleH6", None) or enTrans.get(
"addressTitleH6", None
)
fieldAreaTitleH6 = translations.get("fieldAreaTitleH6", None) or enTrans.get(
"fieldAreaTitleH6", None
)
locationTitleH6 = translations.get("locationTitleH6", None) or enTrans.get(
"locationTitleH6", None
)
latitudeTxt = translations.get("latitudeTxt", None) or enTrans.get(
"latitudeTxt", None
)
longitudeTxt = translations.get("longitudeTxt", None) or enTrans.get(
"longitudeTxt", None
)
indexHeadingDiv = translations.get("indexHeadingDiv", None) or enTrans.get(
"indexHeadingDiv", None
)
indexTitleTh = translations.get("indexTitleTh", None) or enTrans.get(
"indexTitleTh", None
)
indexSerialTh = translations.get("indexSerialTh", None) or enTrans.get(
"indexSerialTh", None
)
indexPageTh = translations.get("indexPageTh", None) or enTrans.get(
"indexPageTh", None
)
indexTitle0_5Td = translations.get("indexTitle0_5Td", None) or enTrans.get(
"indexTitle0_5Td", None
)
indexTitle0_7Td = translations.get("indexTitle0_7Td", None) or enTrans.get(
"indexTitle0_7Td", None
)
indexTitle1Td = translations.get("indexTitle1Td", None) or enTrans.get(
"indexTitle1Td", None
)
indexTitle2Td = translations.get("indexTitle2Td", None) or enTrans.get(
"indexTitle2Td", None
)
indexTitle3Td = translations.get("indexTitle3Td", None) or enTrans.get(
"indexTitle3Td", None
)
indexTitle4Td = translations.get("indexTitle4Td", None) or enTrans.get(
"indexTitle4Td", None
)
indexTitle5Td = translations.get("indexTitle5Td", None) or enTrans.get(
"indexTitle5Td", None
)
indexTitle6Td = translations.get("indexTitle6Td", None) or enTrans.get(
"indexTitle6Td", None
)
indexTitle7Td = translations.get("indexTitle7Td", None) or enTrans.get(
"indexTitle7Td", None
)
indexTitle7_3Td = translations.get("indexTitle7_3Td", None) or enTrans.get(
"indexTitle7_3Td", None
)
indexTitle7_6Td = translations.get("indexTitle7_6Td", None) or enTrans.get(
"indexTitle7_6Td", None
)
indexTitle8Td = translations.get("indexTitle8Td", None) or enTrans.get(
"indexTitle8Td", None
)
indexTitle9Td = translations.get("indexTitle9Td", None) or enTrans.get(
"indexTitle9Td", None
)
indexTitle10Td = translations.get("indexTitle10Td", None) or enTrans.get(
"indexTitle10Td", None
)
indexTitle11Td = translations.get("indexTitle11Td", None) or enTrans.get(
"indexTitle11Td", None
)
indexTitle12Td = translations.get("indexTitle12Td", None) or enTrans.get(
"indexTitle12Td", None
)
indexTitle13Td = translations.get("indexTitle13Td", None) or enTrans.get(
"indexTitle13Td", None
)
indexTitle14Td = translations.get("indexTitle14Td", None) or enTrans.get(
"indexTitle14Td", None
)
indexTitle15Td = translations.get("indexTitle15Td", None) or enTrans.get(
"indexTitle15Td", None
)
indexTitle16Td = translations.get("indexTitle16Td", None) or enTrans.get(
"indexTitle16Td", None
)
indexTitle17Td = translations.get("indexTitle17Td", None) or enTrans.get(
"indexTitle17Td", None
)
decisionTreeCloudyCondH4 = translations.get(
"decisionTreeCloudyCondH4", None
) or enTrans.get("decisionTreeCloudyCondH4", None)
decisionTreeCloudyCondH5 = translations.get(
"decisionTreeCloudyCondH5", None
) or enTrans.get("decisionTreeCloudyCondH5", None)
decisionTreeNDVICondH4 = translations.get(
"decisionTreeNDVICondH4", None
) or enTrans.get("decisionTreeNDVICondH4", None)
decisionTreeNDRECondH4 = translations.get(
"decisionTreeNDRECondH4", None
) or enTrans.get("decisionTreeNDRECondH4", None)
decisionTreeDirH3 = translations.get("decisionTreeDirH3", None) or enTrans.get(
"decisionTreeDirH3", None
)
decisionTreeETCIH3 = translations.get("decisionTreeETCIH3", None) or enTrans.get(
"decisionTreeETCIH3", None
)
decisionTreeCropCauses = translations.get(
"decisionTreeCropCauses", None
) or enTrans.get("decisionTreeCropCauses", None)
decisionTreeIrriCauses = translations.get(
"decisionTreeIrriCauses", None
) or enTrans.get("decisionTreeIrriCauses", None)
decisionTreeSoilP = translations.get("decisionTreeSoilP", None) or enTrans.get(
"decisionTreeSoilP", None
)
decisionTreeSoilH3 = translations.get("decisionTreeSoilH3", None) or enTrans.get(
"decisionTreeSoilH3", None
)
decisionTreeRVIH3 = translations.get("decisionTreeRVIH3", None) or enTrans.get(
"decisionTreeRVIH3", None
)
decisionTreeSoilMoistH3 = translations.get(
"decisionTreeSoilMoistH3", None
) or enTrans.get("decisionTreeSoilMoistH3", None)
decisionTreeDemH3 = translations.get("decisionTreeDemH3", None) or enTrans.get(
"decisionTreeDemH3", None
)
decisionTreeNDVIH3 = translations.get("decisionTreeNDVIH3", None) or enTrans.get(
"decisionTreeNDVIH3", None
)
decisionTreeNDREH3 = translations.get("decisionTreeNDREH3", None) or enTrans.get(
"decisionTreeNDREH3", None
)
decisionTreeNDWIH3 = translations.get("decisionTreeNDWIH3", None) or enTrans.get(
"decisionTreeNDWIH3", None
)
decisionTreeBasicH3 = translations.get("decisionTreeBasicH3", None) or enTrans.get(
"decisionTreeBasicH3", None
)
weatherTitleStnH3 = translations.get("weatherTitleStnH3", None) or enTrans.get(
"weatherTitleStnH3", None
)
weatherTitleCloudH4 = translations.get("weatherTitleCloudH4", None) or enTrans.get(
"weatherTitleCloudH4", None
)
weatherTitleTempMinH4 = translations.get(
"weatherTitleTempMinH4", None
) or enTrans.get("weatherTitleTempMinH4", None)
weatherTitleTempMaxH4 = translations.get(
"weatherTitleTempMaxH4", None
) or enTrans.get("weatherTitleTempMaxH4", None)
weatherTitleWindH4 = translations.get("weatherTitleWindH4", None) or enTrans.get(
"weatherTitleWindH4", None
)
weatherTitleWindDirH4 = translations.get(
"weatherTitleWindDirH4", None
) or enTrans.get("weatherTitleWindDirH4", None)
weatherTitleHumidityH4 = translations.get(
"weatherTitleHumidityH4", None
) or enTrans.get("weatherTitleHumidityH4", None)
weatherTitlePressureH4 = translations.get(
"weatherTitlePressureH4", None
) or enTrans.get("weatherTitlePressureH4", None)
forcastHeadingDiv = translations.get("forcastHeadingDiv", None) or enTrans.get(
"forcastHeadingDiv", None
)
weatherDateThH4 = translations.get("weatherDateThH4", None) or enTrans.get(
"weatherDateThH4", None
)
weatherSummaryThH4 = translations.get("weatherSummaryThH4", None) or enTrans.get(
"weatherSummaryThH4", None
)
weatherMinTempThH4 = translations.get("weatherMinTempThH4", None) or enTrans.get(
"weatherMinTempThH4", None
)
weatherMaxTempThH4 = translations.get("weatherMaxTempThH4", None) or enTrans.get(
"weatherMaxTempThH4", None
)
weatherRainThH4 = translations.get("weatherRainThH4", None) or enTrans.get(
"weatherRainThH4", None
)
weatherMaxPrecipitationThH4 = translations.get(
"weatherMaxPrecipitationThH4", None
) or enTrans.get("weatherMaxPrecipitationThH4", None)
weatherCloudCoverThH4 = translations.get(
"weatherCloudCoverThH4", None
) or enTrans.get("weatherCloudCoverThH4", None)
weatherGraphHeadingDiv = translations.get(
"weatherGraphHeadingDiv", None
) or enTrans.get("weatherGraphHeadingDiv", None)
demInfoP = translations.get("demInfoP", None) or enTrans.get("demInfoP", None)
ndviInfoP = translations.get("ndviInfoP", None) or enTrans.get("ndviInfoP", None)
scientifiyBackgroundTxt = translations.get(
"scientifiyBackgroundTxt", None
) or enTrans.get("scientifiyBackgroundTxt", None)
ndviScientificP = translations.get("ndviScientificP", None) or enTrans.get(
"ndviScientificP", None
)
goodHeightCondTxt = translations.get("goodHeightCondTxt", None) or enTrans.get(
"goodHeightCondTxt", None
)
smallHeightCondTxt = translations.get("smallHeightCondTxt", None) or enTrans.get(
"smallHeightCondTxt", None
)
rgbHeadingDiv = translations.get("rgbHeadingDiv", None) or enTrans.get(
"rgbHeadingDiv", None
)
rgbInfoP = translations.get("rgbInfoP", None) or enTrans.get("rgbInfoP", None)
colorBlindHeadingDiv = translations.get(
"colorBlindHeadingDiv", None
) or enTrans.get("colorBlindHeadingDiv", None)
rviScientificP = translations.get("rviScientificP", None) or enTrans.get(
"rviScientificP", None
)
soilMoistScientificP = translations.get(
"soilMoistScientificP", None
) or enTrans.get("soilMoistScientificP", None)
eviInfoP = translations.get("eviInfoP", None) or enTrans.get("eviInfoP", None)
eviScientificP = translations.get("eviScientificP", None) or enTrans.get(
"eviScientificP", None
)
saviInfoP = translations.get("saviInfoP", None) or enTrans.get("saviInfoP", None)
saviScientificP = translations.get("saviScientificP", None) or enTrans.get(
"saviScientificP", None
)
reclInfoP = translations.get("reclInfoP", None) or enTrans.get("reclInfoP", None)
ndreInfoP2 = translations.get("ndreInfoP2", None) or enTrans.get("ndreInfoP2", None)
ndreSubHeadingDiv = translations.get("ndreSubHeadingDiv", None) or enTrans.get(
"ndreSubHeadingDiv", None
)
ndreInfoP = translations.get("ndreInfoP", None) or enTrans.get("ndreInfoP", None)
ndreScientificP = translations.get("ndreScientificP", None) or enTrans.get(
"ndreScientificP", None
)
ndwiInfoP = translations.get("ndwiInfoP", None) or enTrans.get("ndwiInfoP", None)
ndwiScientificP = translations.get("ndwiScientificP", None) or enTrans.get(
"ndwiScientificP", None
)
ndmiInfoP = translations.get("ndmiInfoP", None) or enTrans.get("ndmiInfoP", None)
ndmiScientificP = translations.get("ndmiScientificP", None) or enTrans.get(
"ndmiScientificP", None
)
evapoInfoP = translations.get("evapoInfoP", None) or enTrans.get("evapoInfoP", None)
evapoH4 = translations.get("evapoH4", None) or enTrans.get("evapoH4", None)
soilHealthHeadingDiv = translations.get(
"soilHealthHeadingDiv", None
) or enTrans.get("soilHealthHeadingDiv", None)
soilInfoP = translations.get("soilInfoP", None) or enTrans.get("soilInfoP", None)
decisionTreeNDVI2H3 = decisionTreeNDVIH3
decisionTreeNDWI2H3 = decisionTreeNDWIH3
# 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"]
)
# demIndexImg = allReportValues.get(
# 'demIndexImg', None) or defaultValues['demIndexImg']
# demGraphImg = allReportValues.get(
# 'demGraphImg', None) or defaultValues['demGraphImg']
demGoodHeightImg = (
allReportValues.get("demGoodHeightImg", None)
or defaultValues["demGoodHeightImg"]
)
# demSmallHeightImg = allReportValues.get(
# 'demSmallHeightImg', None) or defaultValues['demSmallHeightImg']
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"]
)
reclGoodHeightImg = (
allReportValues.get("reclGoodHeightImg", None)
or defaultValues["reclGoodHeightImg"]
)
reclSmallHeightImg = (
allReportValues.get("reclSmallHeightImg", None)
or defaultValues["reclSmallHeightImg"]
)
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"]
fieldBdyImg = (
allReportValues.get("fieldBdyImg", None) or defaultValues["fieldBdyImg"]
)
fieldImgPaddings = (
eval(allReportValues.get("fieldImgPaddings", None) or "None")
or defaultValues["fieldImgPaddings"]
) # in % ratio
mapImgSize = (
eval(allReportValues.get("mapImgSize", None) or "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"]
)
isPolygon = (
eval(allReportValues.get("isPolygon", None) or "None")
or defaultValues["isPolygon"]
)
isOilPalm = (
eval(allReportValues.get("isOilPalm", None) or "None")
or defaultValues["isOilPalm"]
)
isSmallPlant = (
eval(allReportValues.get("isSmallPlant", None) or "None")
or defaultValues["isSmallPlant"]
)
isCloudy = (
eval(allReportValues.get("isCloudy", None) or "None")
or defaultValues["isCloudy"]
)
# other items to replace in template
showOnlyRVI = ndviGoodHeightImg == unavailableImg
displayNoneStyle = "display: none"
displayBlockStyle = "display: block"
displayTrStyle = "display: table-row"
palmOnlyStyle = displayNoneStyle if not isOilPalm else displayBlockStyle
palmOnlyTrStyle = displayNoneStyle if not isOilPalm else displayTrStyle
nonPalmTrStyle = displayNoneStyle if isOilPalm else displayTrStyle
nonPalmStyle = displayNoneStyle if isOilPalm else displayBlockStyle
nonPalmNonRviStyle = (
displayNoneStyle if isOilPalm or showOnlyRVI else displayBlockStyle
)
nonPalmRviStyle = (
displayNoneStyle if isOilPalm or not showOnlyRVI else displayBlockStyle
)
polygonOnlyStyle = displayNoneStyle if not isPolygon else displayBlockStyle
nonPolygonStyle = displayNoneStyle if isPolygon else displayBlockStyle
nonRVIOnlyStyle = displayNoneStyle if showOnlyRVI else displayBlockStyle
rviOnlyStyle = displayNoneStyle if not showOnlyRVI else displayBlockStyle
rviNonPolygonStyle = (
displayNoneStyle if isPolygon or not showOnlyRVI else displayBlockStyle
)
nonRviNonPolygonStyle = (
displayNoneStyle if showOnlyRVI or isPolygon 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,
)
imgRatio = imgHeight / imgWidth
dirImgHeight = 230 if imgRatio > 0.836 else 275 * imgRatio
decisionTreeFieldDirImgStyle = "height: %spx; aspect-ratio: %s;" % (
dirImgHeight,
1 / imgRatio,
)
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;"
+ ("min-height: %spx" % (200 + dirImgHeight))
)
# rvi decision tree
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,
)
# satImg not used in decisionTree, satImg4/3 used in decisionTree
satImgStyle = "margin-top: 16px; max-height: 250px; max-width: 380px;" + (
"height: 250px; width: auto;"
if imgRatio > 0.658
else "height: auto; width: 380px"
)
# oil palm decision tree
mapImgHeight3 = 426 if mapImgRatio > 1.2 else 355 * mapImgRatio
mapImgWidth3 = mapImgHeight3 / mapImgRatio
mapImgHPad3 = mapImgWidth3 * fieldImgPaddings[0] / (fieldImgPaddings[0] * 2 + 1)
mapImgVPad3 = mapImgHeight3 * fieldImgPaddings[1] / (fieldImgPaddings[1] * 2 + 1)
decisionTreeFieldDirImgStyle3 = "height: %spx; width: %spx; padding: %spx %spx;" % (
mapImgHeight3,
mapImgWidth3,
mapImgVPad3,
mapImgHPad3,
)
satImgStyle3 = "position: relative; top: 8px; height: %spx; width: %spx" % (
mapImgHeight3,
mapImgWidth3,
)
mapImgHeight4 = 500 if mapImgRatio > 1.1628 else 430 * mapImgRatio
mapImgWidth4 = mapImgHeight4 / mapImgRatio
mapImgHPad4 = mapImgWidth4 * fieldImgPaddings[0] / (fieldImgPaddings[0] * 2 + 1)
mapImgVPad4 = mapImgHeight4 * fieldImgPaddings[1] / (fieldImgPaddings[1] * 2 + 1)
decisionTreeFieldImgStyle4 = "height: %spx; width: %spx; padding: %spx %spx;" % (
mapImgHeight4,
mapImgWidth4,
mapImgVPad4,
mapImgHPad4,
)
satImgStyle4 = "height: %spx; width: %spx" % (mapImgHeight4, mapImgWidth4)
fieldAreaValueH6 = fieldAreaValue + " sq m (approx.)"
latValueH6 = latitudeTxt + latValue
longValueH6 = longitudeTxt + longValue
decisionTreeETCIImg = rgbETCIImg
decisionTreeRVIImg = rviImg
decisionTreeSoilMoistImg = soilMoistImg
decisionTreeNDVIImg = ndviGoodHeightImg
decisionTreeNDVI2Img = ndviSmallHeightImg
decisionTreeDemImg = demGoodHeightImg
decisionTreeSoilImg = socGoodHeightImg
decisionTreeNDREImg = ndreGoodHeightImg
decisionTreeNDWIImg = ndwiGoodHeightImg
decisionTreeNDWI2Img = ndwiSmallHeightImg
decisionTreeCompassImg = "report_images/compass/%s.jpg" % (
langCode if langCode != "mr" else "hi"
)
isDEMPresent = os.path.exists(demGoodHeightImg)
if isDEMPresent:
demRedZones = getRedZones(demGoodHeightImg)
demInfoP += "
" + getFullInstructions(
"dem%s" % (1 if len(demRedZones) == 0 else 0),
demRedZones,
translations,
langCode,
)
isSOCPresent = os.path.exists(socGoodHeightImg)
if isSOCPresent:
socRedZones = getRedZones(socGoodHeightImg)
decisionTreeSoilP += "
" + getFullInstructions(
"soil%s" % (1 if len(socRedZones) == 0 else 0),
socRedZones,
translations,
langCode,
)
# 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
# recl
reclSubHeadingDiv = indexTitle0_7Td
# reclScientificH2 = scientifiyBackgroundTxt
# reclScaleImg = "report_images/weatherGraph.JPG"
reclGoodHeightH3 = goodHeightCondTxt
# reclGoodHeightScaleImg = "report_images/weatherGraph.JPG"
# reclSmallHeightScaleImg = "report_images/weatherGraph.JPG"
reclSmallHeightH3 = 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 = indexTitle17Td
# soilScaleImg = "report_images/weatherGraph.JPG"
soilGoodHeightH3 = goodHeightCondTxt
# soilGoodHeightScaleImg = "report_images/weatherGraph.JPG"
# soilSmallHeightScaleImg = "report_images/weatherGraph.JPG"
soilSmallHeightH3 = smallHeightCondTxt
# others
thanksH1 = "KEEP MONITORING FARMS"
extra = 1 if isOilPalm else 0
indexSerial1Td = str(1 + extra)
indexPage1Td = str(2 + extra)
page1_5P = "page 2"
page1P = "page %s" % (1)
page2P = "page %s" % (2 + extra)
page3P = "page %s" % (3 + extra)
page4P = "page %s" % (4 + extra)
page5P = "page %s" % (5 + extra)
page6P = "page %s" % (6 + extra)
page7P = "page %s" % (7 + extra)
page8P = "page %s" % (8 + extra)
page9P = "page %s" % (9 + extra)
page10P = "page %s" % (10 + extra)
page11P = "page %s" % (11 + extra)
page12P = "page %s" % (12 + extra)
page13P = "page %s" % (13 + extra)
page2Pad = 1355
page3Pad = 2710
page4Pad = 4065
page5Pad = 5420
page6Pad = 6775
page7Pad = 8130
page8Pad = 9485
page9Pad = 10840
page10Pad = 12195
page11Pad = 13555
page12Pad = 14905
page13Pad = 16260
pageExtra = -15 if isOilPalm else 0
pageNoPStyle = "position: absolute; left: 835px; top: %spx;" % (1330 + pageExtra)
page1_5Style = "margin-top: %spx;" % (page2Pad + pageExtra - 1 * 5)
page2Style = "margin-top: %spx;" % (
(page3Pad + pageExtra - 2 * 10 if isOilPalm else page2Pad)
)
page3Style = "margin-top: %spx;" % (page3Pad)
page4Style = "margin-top: %spx;" % (page4Pad)
page5Style = "margin-top: %spx;" % (page5Pad)
page6Style = "margin-top: %spx;" % (page7Pad if isOilPalm else page6Pad)
page7Style = "margin-top: %spx;" % (page8Pad if isOilPalm else page7Pad)
page8Style = "margin-top: %spx;" % (page9Pad if isOilPalm else page8Pad)
page9Style = "margin-top: %spx;" % (page10Pad if isOilPalm else page9Pad)
page10Style = "margin-top: %spx;" % (page11Pad if isOilPalm else page10Pad)
page11Style = "margin-top: %spx;" % (page12Pad if isOilPalm else page11Pad)
page12Style = "margin-top: %spx;" % (page13Pad if isOilPalm else page12Pad)
page13Style = "margin-top: %spx;" % (page13Pad)
scale1VerImg = "https://farmonaut.com/Images/colormap_farmonaut_vertical.jpg"
scale2VerImg = "https://farmonaut.com/Images/colormap2_vertical.jpg"
scale1HoriImg = "report_images/colormap_farmonaut_horizontal.jpg"
scale2HoriImg = "report_images/colormap2_horizontal.jpg"
decisionTreeCropH3 = (
decisionTreeRVIH3
if isCloudy
else decisionTreeNDVI2H3
if isSmallPlant
else decisionTreeNDVIH3
)
decisionTreeCropImg = (
decisionTreeRVIImg
if isCloudy
else decisionTreeNDVI2Img
if isSmallPlant
else decisionTreeNDVIImg
)
decisionTreeCropP = (
decisionTreeCloudyCropP
if isCloudy
else decisionTreeEarlyCropP
if isSmallPlant
else decisionTreeLaterCropP
)
isDTCropGood = decisionTreeCropP == translations["sms1_"]
decisionTreeMainCropP = decisionTreeCropP
if not isDTCropGood:
decisionTreeMainCropP += "
%s" % (translations["causesCropStr"])
for value in decisionTreeCropCauses.split(","):
decisionTreeMainCropP += "
- %s" % (value)
decisionTreeCropScaleImg = scale2VerImg if isSmallPlant else scale1VerImg
decisionTreeCropHoriScaleImg = scale2HoriImg if isSmallPlant else scale1HoriImg
decisionTreeIrriH3 = (
decisionTreeSoilMoistH3
if isCloudy
else decisionTreeNDWI2H3
if isSmallPlant
else decisionTreeNDWIH3
)
decisionTreeIrriImg = (
decisionTreeSoilMoistImg
if isCloudy
else decisionTreeNDWI2Img
if isSmallPlant
else decisionTreeNDWIImg
)
decisionTreeIrriP = (
decisionTreeCloudyIrriP
if isCloudy
else decisionTreeEarlyIrriP
if isSmallPlant
else decisionTreeLaterIrriP
)
isDTIrriGood = decisionTreeIrriP == translations["sms_1"]
decisionTreeMainIrriP = decisionTreeIrriP
if not isDTIrriGood:
decisionTreeMainIrriP += "
%s" % (translations["causesIrriStr"])
for value in decisionTreeIrriCauses.split(","):
decisionTreeMainIrriP += "
- %s" % (value)
decisionTreeIrriScaleImg = scale2VerImg if isSmallPlant else scale1VerImg
decisionTreeIrriHoriScaleImg = scale2HoriImg if isSmallPlant else scale1HoriImg
# 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("p", allTextStyle, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlStyle(
"page_no_p", pageNoPStyle, 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 = replaceHtmlStyle(
".non_polygon", nonPolygonStyle, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlStyle(
".polygon_only", polygonOnlyStyle, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlStyle(
".non_rvi__non_polygon", nonRviNonPolygonStyle, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlStyle(
".rvi_only__non_polygon", rviNonPolygonStyle, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlStyle(
".palm_only", palmOnlyStyle, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlStyle(
".palm_only_tr", palmOnlyTrStyle, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlStyle(
".non_palm_tr", nonPalmTrStyle, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlStyle(
".non_palm", nonPalmStyle, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlStyle(
".non_palm__non_rvi", nonPalmNonRviStyle, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlStyle(
".non_palm__rvi", nonPalmRviStyle, 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(
"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(
"indexTitle5Td", indexTitle5Td, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlData(
"indexTitle6Td", indexTitle6Td, htmlStr, initialIndex
)
# non rvi table
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
)
# polygon only table
htmlStr, initialIndex = replaceHtmlData(
"indexSerialTh", indexSerialTh, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlData(
"indexTitleTh", indexTitleTh, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlData(
"indexPageTh", indexPageTh, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlData(
"indexTitle0_5Td", indexTitle0_5Td, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlData(
"indexSerial1Td", indexSerial1Td, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlData(
"indexTitle1Td", indexTitle1Td, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlData(
"indexPage1Td", indexPage1Td, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlData(
"indexTitle2Td", indexTitle2Td, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlData("page1P", page1P, htmlStr, initialIndex)
# page 1.5 - oil palm
# htmlStr, initialIndex = replaceHtmlData(
# 'oilPalmHeadingDiv', decisionTreeHeadingDiv, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlEleStyle(
"decisionTreeFieldSatImg", satImgStyle3, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"decisionTreeFieldSatImg", fieldBdyImg, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlEleStyle(
"decisionTreeFieldDirImg", decisionTreeFieldDirImgStyle3, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"decisionTreeFieldDirImg", decisionTreeFieldDirImg, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"decisionTreeCompassImg", decisionTreeCompassImg, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlData(
"reclGoodHeightH3", reclSubHeadingDiv, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlEleStyle(
"reclGoodHeightSatImg", satImgStyle4, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"reclGoodHeightSatImg", mapImg, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlEleStyle(
"reclGoodHeightImg", decisionTreeFieldImgStyle4, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"reclGoodHeightImg", reclGoodHeightImg, htmlStr, initialIndex
)
# htmlStr, initialIndex = replaceHtmlImgSrc(
# 'decisionTreeCropScaleImg', decisionTreeCropScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
"reclInfoP", reclInfoP, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlData(
"ndreGoodHeightH3", ndreSubHeadingDiv, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlEleStyle(
"ndreGoodHeightSatImg", satImgStyle4, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"ndreGoodHeightSatImg", mapImg, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlEleStyle(
"ndreGoodHeightImg", decisionTreeFieldImgStyle4, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"ndreGoodHeightImg", ndreGoodHeightImg, htmlStr, initialIndex
)
# htmlStr, initialIndex = replaceHtmlImgSrc(
# 'decisionTreeCropScaleImg', decisionTreeCropScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
"ndreInfoP", ndreInfoP2, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlEleStyle(
"page1_5P", page1_5Style, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlData("page1_5P", page1_5P, 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(
"decisionTreeDirH4", decisionTreeDirH3, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlEleStyle(
"decisionTreeFieldDirImg", decisionTreeFieldDirImgStyle, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"decisionTreeFieldDirImg", decisionTreeFieldDirImg, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"decisionTreeCompassImg", decisionTreeCompassImg, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlData(
"decisionTreeCropH3", decisionTreeCropH3, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"decisionTreeCropSatImg", mapImg, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"decisionTreeCropImg", decisionTreeCropImg, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"decisionTreeCropScaleImg", decisionTreeCropScaleImg, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlData(
"decisionTreeCropP", decisionTreeMainCropP, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlEleStyle(
"decisionTreeCropTracImg",
"position: absolute; width: 350px; left: 470px; top: 150px; %s"
% (displayBlockStyle if isDTCropGood else displayNoneStyle),
htmlStr,
initialIndex,
)
htmlStr, initialIndex = replaceHtmlData(
"decisionTreeIrriH3", decisionTreeIrriH3, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"decisionTreeIrriSatImg", mapImg, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"decisionTreeIrriImg", decisionTreeIrriImg, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"decisionTreeIrriScaleImg", decisionTreeIrriScaleImg, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlData(
"decisionTreeIrriP", decisionTreeMainIrriP, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlEleStyle(
"decisionTreeIrriTracImg",
"position: absolute; width: 350px; left: 470px; top: 150px; %s"
% (displayBlockStyle if isDTIrriGood else displayNoneStyle),
htmlStr,
initialIndex,
)
htmlStr, initialIndex = replaceHtmlData(
"decisionTreeDemH3", decisionTreeDemH3, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"decisionTreeDemSatImg", mapImg, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"decisionTreeDemImg", decisionTreeDemImg, htmlStr, initialIndex
)
# htmlStr, initialIndex = replaceHtmlImgSrc(
# 'decisionTreeDemScaleImg', decisionTreeDemScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
"decisionTreeDemP", demInfoP, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlData(
"decisionTreeSocH3", decisionTreeSoilH3, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"decisionTreeSocSatImg", mapImg, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"decisionTreeSocImg", decisionTreeSoilImg, htmlStr, initialIndex
)
# htmlStr, initialIndex = replaceHtmlImgSrc(
# 'decisionTreeSocScaleImg', decisionTreeSocScaleImg, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData(
"decisionTreeSocP", decisionTreeSoilP, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlEleStyle(
"page2P", page2Style, 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 = replaceHtmlData(
"decisionTreeScaleH3", decisionTreeScaleH3, 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 = replaceHtmlEleStyle(
"page2P", page2Style, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlData("page2P", page2P, htmlStr, initialIndex)
# page 2 oil_palm_only
htmlStr, initialIndex = replaceHtmlData(
"decisionTreeHeadingDiv", decisionTreeHeadingDiv, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlEleStyle(
"decisionTreeFieldSatImg", satImgStyle3, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"decisionTreeFieldSatImg", fieldBdyImg, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlEleStyle(
"decisionTreeFieldDirImg", decisionTreeFieldDirImgStyle3, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"decisionTreeFieldDirImg", decisionTreeFieldDirImg, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"decisionTreeCompassImg", decisionTreeCompassImg, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlData(
"decisionTreeCropH3", decisionTreeCropH3, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlEleStyle(
"decisionTreeCropSatImg", satImgStyle4, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"decisionTreeCropSatImg", mapImg, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlEleStyle(
"decisionTreeCropImg", decisionTreeFieldImgStyle4, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"decisionTreeCropImg", decisionTreeCropImg, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"decisionTreeCropScaleImg", decisionTreeCropHoriScaleImg, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlData(
"decisionTreeCropP", decisionTreeCropP, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlData(
"decisionTreeIrriH3", decisionTreeIrriH3, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlEleStyle(
"decisionTreeIrriSatImg", satImgStyle4, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"decisionTreeIrriSatImg", mapImg, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlEleStyle(
"decisionTreeIrriImg", decisionTreeFieldImgStyle4, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"decisionTreeIrriImg", decisionTreeIrriImg, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlImgSrc(
"decisionTreeIrriScaleImg", decisionTreeIrriHoriScaleImg, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlData(
"decisionTreeIrriP", decisionTreeIrriP, htmlStr, initialIndex
)
htmlStr, initialIndex = replaceHtmlEleStyle(
"page2P", page2Style, 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 = replaceHtmlEleStyle(
"page3P", page3Style, 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)
htmlStr, initialIndex = replaceHtmlEleStyle(
"page4P", page4Style, 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 = replaceHtmlEleStyle(
"page5P", page5Style, 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
)
# 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("thanksH1", thanksH1, htmlStr, initialIndex)
htmlStr, initialIndex = replaceHtmlData("page13P", page13P, htmlStr, initialIndex)
return htmlStr
# run commands
# createExtractTranslationTxt()
# removeKeysInTranslation(["bn", "mr", "te", "ta", "kn", "ar", "en", "hi", "uz"], ['weatherHeadingDiv', 'decisionTreeHeadingDiv'])
# createTranslationJson(["bn", "mr", "te", "ta", "kn", "ar", "en", "hi", "uz", "pa"])
# openFile()
# time.sleep(1)
# "bn", "mr", "te", "ta", "kn", "ar", "en", "hi", "uz", "pa", "gu", "ml", "or", "fr"
# langs = ["bn", "mr", "te", "ta", "kn", "ar", "en", "hi", "uz", "pa", "gu", "or", "ml"]
# for langCode in langs:
# # langCode = "en"
# 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()
# longUrl = "https://storage.googleapis.com/farmbase-b2f7e.appspot.com/PaidMonitoredFields/fSRlyKzCxxMJHJqDzpGhQImyyxf2/1669891376338/20221013/report.pdf?X-Goog-Algorithm=GOOG4-RSA-SHA256&X-Goog-Credential=farmbase-b2f7e%40appspot.gserviceaccount.com%2F20221209%2Fauto%2Fstorage%2Fgoog4_request&X-Goog-Date=20221209T131824Z&X-Goog-Expires=900&X-Goog-SignedHeaders=host&X-Goog-Signature=319ecd82f2015e6886788b82453319747d25ed2f56491b46d6700cecfe93358d95d3fe258a1aab5cfc89287af1770b83a3cf3f8550bb5f4c19e0bc37af48cc708f90e5675193b23c32b50bd707332a7de513b28e2beb6991d96c388e83325e66575a07096b39864e5de55f53efdbc4e00880b547608fed7d07873d6e0c9221acf8dc6722d46955d446d22c9b6f268ccbbf3b6d588b69ead0366c2ded7d681b94f5853d7c404c39c6cfcab2b682500ba1e349e46ebeaf2880ff17650296a9d90eef2688d8bb9456921224826c5ba3cdb9340f9f5700eb8357b9477c65e40d5d19269d788a887f0eabbdaf6b82e6cc7fa6ccf1f6d41188f57f3f620e9fded49baa"
# shortUrl = createShortDynamicLink(longUrl)
# print(shortUrl)