コード例 #1
0
ファイル: MoransI.py プロジェクト: rvinc66/ArcGISRuntimeBook
    def reportHTML(self, htmlFile = None):
        """Generates a graphical html report for Moran's I."""

        #### Shorthand Attributes ####
        zi = self.zi

        #### Progress and Create HTML File Name ####
        writeMSG = ARCPY.GetIDMessage(84228)
        ARCPY.SetProgressor("default", writeMSG)
        ARCPY.AddMessage(writeMSG)
        if not htmlFile:
            prefix = ARCPY.GetIDMessage(84227)
            outputDir = UTILS.returnScratchWorkSpace()
            baseDir = UTILS.getBaseFolder(outputDir)
            htmlFile = UTILS.returnScratchName(prefix, fileType = "TEXT", 
                                           scratchWS = baseDir,
                                           extension = "html")

        #### Obtain Correct Images ####
        imageDir = UTILS.getImageDir()
        clustStr = ARCPY.GetIDMessage(84243)
        dispStr = ARCPY.GetIDMessage(84244)
        if zi <= -2.58:
            imageFile = OS.path.join(imageDir, "dispersedValues01.png")
            info = ("1%", dispStr)
            imageBox = OS.path.join(imageDir, "dispersedBox01.png")
        elif (-2.58 < zi <= -1.96):
            imageFile = OS.path.join(imageDir, "dispersedValues05.png")
            info = ("5%", dispStr)
            imageBox = OS.path.join(imageDir, "dispersedBox05.png")
        elif (-1.96 < zi <= -1.65):
            imageFile = OS.path.join(imageDir, "dispersedValues10.png")
            info = ("10%", dispStr)
            imageBox = OS.path.join(imageDir, "dispersedBox10.png")
        elif (-1.65 < zi < 1.65):
            imageFile = OS.path.join(imageDir, "randomValues.png")
            imageBox = OS.path.join(imageDir, "randomBox.png")
        elif (1.65 <= zi < 1.96):
            imageFile = OS.path.join(imageDir, "clusteredValues10.png")
            info = ("10%", clustStr)
            imageBox = OS.path.join(imageDir, "clusteredBox10.png")
        elif (1.96 <= zi < 2.58):
            imageFile = OS.path.join(imageDir, "clusteredValues05.png")
            info = ("5%", clustStr)
            imageBox = OS.path.join(imageDir, "clusteredBox05.png")
        else:
            imageFile = OS.path.join(imageDir, "clusteredValues01.png")
            info = ("1%", clustStr)
            imageBox = OS.path.join(imageDir, "clusteredBox01.png")

        #### Footnote ####
        footStart = ARCPY.GetIDMessage(84230).format(zi)
        if abs(zi) >= 1.65:
            footEnd = ARCPY.GetIDMessage(84231)
            footEnd = footEnd.format(*info)
            footerText = footStart + footEnd 
        else:
            footEnd = ARCPY.GetIDMessage(84232)
            footerText = footStart + footEnd

        #### Root Element ####
        title = ARCPY.GetIDMessage(84229)
        reportElement, reportTree = REPORT.xmlReport(title = title)

        #### Begin Graphic SubElement ####
        graphicElement = REPORT.xmlGraphic(reportElement, imageFile, 
                                           footerText = footerText)

        #### Floating Table ####
        rowVals = [ [ARCPY.GetIDMessage(84148), self.giString, ""],
                    [ARCPY.GetIDMessage(84151), self.ziString, imageBox],
                    [ARCPY.GetIDMessage(84152), self.pvString, ""] ]

        fTable = REPORT.xmlTable(graphicElement, rowVals, 
                                 tType = "ssFloat")

        #### Moran Table ####
        rowVals = [ [ARCPY.GetIDMessage(84148), self.giString],
                    [ARCPY.GetIDMessage(84149), self.eiString],
                    [ARCPY.GetIDMessage(84150), self.viString],
                    [ARCPY.GetIDMessage(84151), self.ziString],
                    [ARCPY.GetIDMessage(84152), self.pvString] ]

        mTable = REPORT.xmlTable(reportElement, rowVals,
                                 title = ARCPY.GetIDMessage(84160))

        #### Dataset Table ####
        rowVals = [ [UTILS.addColon(ARCPY.GetIDMessage(84233)), 
                     self.ssdo.inputFC],
                    [UTILS.addColon(ARCPY.GetIDMessage(84016)), 
                     self.varName],
                    [UTILS.addColon(ARCPY.GetIDMessage(84234)), 
                     WU.wTypeDispatch[self.wType]],
                    [UTILS.addColon(ARCPY.GetIDMessage(84235)),
                     self.concept],
                    [UTILS.addColon(ARCPY.GetIDMessage(84236)), 
                     str(self.rowStandard)],
                    [UTILS.addColon(ARCPY.GetIDMessage(84237)), 
                     self.thresholdStr],
                    [UTILS.addColon(ARCPY.GetIDMessage(84238)), 
                     str(self.weightsFile)],
                    [UTILS.addColon(ARCPY.GetIDMessage(84418)),
                     str(self.ssdo.selectionSet)] ]

        dTable = REPORT.xmlTable(reportElement, rowVals,
                                 title = ARCPY.GetIDMessage(84239))

        #### Create HTML ####
        html = REPORT.report2html(reportTree, htmlFile)
        ARCPY.AddMessage(htmlFile)

        return htmlFile
コード例 #2
0
    def reportHTML(self, htmlFile=None):
        """Generates a graphical html report for Nearest Neighbor Stat."""

        #### Shorthand Attributes ####
        zScore = self.zn

        #### Progress and Create HTML File Name ####
        writeMSG = ARCPY.GetIDMessage(84228)
        ARCPY.SetProgressor("default", writeMSG)
        ARCPY.AddMessage(writeMSG)
        if not htmlFile:
            prefix = ARCPY.GetIDMessage(84240)
            outputDir = UTILS.returnScratchWorkSpace()
            baseDir = UTILS.getBaseFolder(outputDir)
            htmlFile = UTILS.returnScratchName(prefix,
                                               fileType="TEXT",
                                               scratchWS=baseDir,
                                               extension="html")

        #### Obtain Correct Images ####
        imageDir = UTILS.getImageDir()
        clustStr = ARCPY.GetIDMessage(84243)
        dispStr = ARCPY.GetIDMessage(84244)
        if zScore <= -2.58:
            imageFile = OS.path.join(imageDir, "clusteredPoints01.png")
            info = ("1%", clustStr)
            imageBox = OS.path.join(imageDir, "dispersedBox01.png")
        elif (-2.58 < zScore <= -1.96):
            imageFile = OS.path.join(imageDir, "clusteredPoints05.png")
            info = ("5%", clustStr)
            imageBox = OS.path.join(imageDir, "dispersedBox05.png")
        elif (-1.96 < zScore <= -1.65):
            imageFile = OS.path.join(imageDir, "clusteredPoints10.png")
            info = ("10%", clustStr)
            imageBox = OS.path.join(imageDir, "dispersedBox10.png")
        elif (-1.65 < zScore < 1.65):
            imageFile = OS.path.join(imageDir, "randomPoints.png")
            imageBox = OS.path.join(imageDir, "randomBox.png")
        elif (1.65 <= zScore < 1.96):
            imageFile = OS.path.join(imageDir, "dispersedPoints10.png")
            info = ("10%", dispStr)
            imageBox = OS.path.join(imageDir, "clusteredBox10.png")
        elif (1.96 <= zScore < 2.58):
            imageFile = OS.path.join(imageDir, "dispersedPoints05.png")
            info = ("5%", dispStr)
            imageBox = OS.path.join(imageDir, "clusteredBox05.png")
        else:
            imageFile = OS.path.join(imageDir, "dispersedPoints01.png")
            info = ("1%", dispStr)
            imageBox = OS.path.join(imageDir, "clusteredBox01.png")

        #### Footnote ####
        footStart = ARCPY.GetIDMessage(84230).format(zScore)
        if abs(zScore) >= 1.65:
            footEnd = ARCPY.GetIDMessage(84231)
            footEnd = footEnd.format(*info)
            footerText = footStart + footEnd
        else:
            footEnd = ARCPY.GetIDMessage(84232)
            footerText = footStart + footEnd

        #### Root Element ####
        title = ARCPY.GetIDMessage(84161)
        reportElement, reportTree = REPORT.xmlReport(title=title)

        #### Begin Graphic SubElement ####
        graphicElement = REPORT.xmlGraphic(reportElement,
                                           imageFile,
                                           footerText=footerText)

        #### Floating Table ####
        rowVals = [[ARCPY.GetIDMessage(84164), self.ratioString, ""],
                   [ARCPY.GetIDMessage(84151), self.znString, imageBox],
                   [ARCPY.GetIDMessage(84152), self.pvString, ""]]

        fTable = REPORT.xmlTable(graphicElement, rowVals, tType="ssFloat")

        #### NN Table ####
        rowVals = [[ARCPY.GetIDMessage(84162), self.nnStringD],
                   [ARCPY.GetIDMessage(84163), self.enStringD],
                   [ARCPY.GetIDMessage(84164), self.ratioString],
                   [ARCPY.GetIDMessage(84151), self.znString],
                   [ARCPY.GetIDMessage(84152), self.pvString]]

        nnTable = REPORT.xmlTable(reportElement,
                                  rowVals,
                                  title=ARCPY.GetIDMessage(84161))

        #### Dataset Table ####
        rowVals = [[
            UTILS.addColon(ARCPY.GetIDMessage(84233)), self.ssdo.inputFC
        ], [UTILS.addColon(ARCPY.GetIDMessage(84235)), self.concept],
                   [
                       UTILS.addColon(ARCPY.GetIDMessage(84241)),
                       LOCALE.format("%0.6f", self.studyArea)
                   ],
                   [
                       UTILS.addColon(ARCPY.GetIDMessage(84418)),
                       str(self.ssdo.selectionSet)
                   ]]

        dTable = REPORT.xmlTable(reportElement,
                                 rowVals,
                                 title=ARCPY.GetIDMessage(84239))

        #### Create HTML ####
        html = REPORT.report2html(reportTree, htmlFile)
        ARCPY.AddMessage(htmlFile)

        return htmlFile
コード例 #3
0
    def reportHTML(self, htmlFile = None):
        """Generates a graphical html report for General G."""

        #### Shorthand Attributes ####
        zg = self.zg

        #### Progress and Create HTML File Name ####
        writeMSG = ARCPY.GetIDMessage(84228)
        ARCPY.SetProgressor("default", writeMSG)
        ARCPY.AddMessage(writeMSG)
        if not htmlFile:
            prefix = ARCPY.GetIDMessage(84242)
            outputDir = UTILS.returnScratchWorkSpace()
            baseDir = UTILS.getBaseFolder(outputDir)
            htmlFile = UTILS.returnScratchName(prefix, fileType = "TEXT", 
                                               scratchWS = baseDir,
                                               extension = "html")

        #### Obtain Correct Images ####
        imageDir = UTILS.getImageDir()
        lowStr = ARCPY.GetIDMessage(84245)
        highStr = ARCPY.GetIDMessage(84246)
        if zg <= -2.58:
            imageFile = OS.path.join(imageDir, "lowGGValues01.png")
            info = ("1%", lowStr)
            imageBox = OS.path.join(imageDir, "dispersedBox01.png")
        elif (-2.58 < zg <= -1.96):
            imageFile = OS.path.join(imageDir, "lowGGValues05.png")
            info = ("5%", lowStr)
            imageBox = OS.path.join(imageDir, "dispersedBox05.png")
        elif (-1.96 < zg <= -1.65):
            imageFile = OS.path.join(imageDir, "lowGGValues10.png")
            info = ("10%", lowStr)
            imageBox = OS.path.join(imageDir, "dispersedBox10.png")
        elif (-1.65 < zg < 1.65):
            imageFile = OS.path.join(imageDir, "randomGGValues.png")
            imageBox = OS.path.join(imageDir, "randomBox.png")
        elif (1.65 <= zg < 1.96):
            imageFile = OS.path.join(imageDir, "highGGValues10.png")
            info = ("10%", highStr)
            imageBox = OS.path.join(imageDir, "clusteredBox10.png")
        elif (1.96 <= zg < 2.58):
            imageFile = OS.path.join(imageDir, "highGGValues05.png")
            info = ("5%", highStr)
            imageBox = OS.path.join(imageDir, "clusteredBox05.png")
        else:
            imageFile = OS.path.join(imageDir, "highGGValues01.png")
            info = ("1%", highStr)
            imageBox = OS.path.join(imageDir, "clusteredBox01.png")

        #### Footnote ####
        footStart = ARCPY.GetIDMessage(84230).format(zg)
        if abs(zg) >= 1.65:
            footEnd = ARCPY.GetIDMessage(84231)
            footEnd = footEnd.format(*info)
            footerText = footStart + footEnd 
        else:
            footEnd = ARCPY.GetIDMessage(84232)
            footerText = footStart + footEnd

        #### Root Element ####
        title = ARCPY.GetIDMessage(84247)
        reportElement, reportTree = REPORT.xmlReport(title = title)

        #### Begin Graphic SubElement ####
        graphicElement = REPORT.xmlGraphic(reportElement, imageFile, 
                                           footerText = footerText)

        #### Floating Table ####
        rowVals = [ [ARCPY.GetIDMessage(84153), self.ggString, ""],
                    [ARCPY.GetIDMessage(84151), self.zgString, imageBox],
                    [ARCPY.GetIDMessage(84152), self.pvString, ""] ]

        fTable = REPORT.xmlTable(graphicElement, rowVals, 
                                 tType = "ssFloat")

        #### General G Table ####
        rowVals = [ [ARCPY.GetIDMessage(84153), self.ggString],
                    [ARCPY.GetIDMessage(84154), self.egString],
                    [ARCPY.GetIDMessage(84150), self.vgString],
                    [ARCPY.GetIDMessage(84151), self.zgString],
                    [ARCPY.GetIDMessage(84152), self.pvString] ]

        mTable = REPORT.xmlTable(reportElement, rowVals,
                                 title = ARCPY.GetIDMessage(84159))

        #### Dataset Table ####
        rowVals = [ [UTILS.addColon(ARCPY.GetIDMessage(84233)), 
                     self.ssdo.inputFC],
                    [UTILS.addColon(ARCPY.GetIDMessage(84016)), 
                     self.varName],
                    [UTILS.addColon(ARCPY.GetIDMessage(84234)), 
                     WU.wTypeDispatch[self.wType]],
                    [UTILS.addColon(ARCPY.GetIDMessage(84235)),
                     self.concept],
                    [UTILS.addColon(ARCPY.GetIDMessage(84236)), 
                     str(self.rowStandard)],
                    [UTILS.addColon(ARCPY.GetIDMessage(84237)), 
                     self.thresholdStr],
                    [UTILS.addColon(ARCPY.GetIDMessage(84238)), 
                     str(self.weightsFile)],
                    [UTILS.addColon(ARCPY.GetIDMessage(84418)),
                     str(self.ssdo.selectionSet)] ]

        dTable = REPORT.xmlTable(reportElement, rowVals,
                                 title = ARCPY.GetIDMessage(84239))

        #### Create HTML ####
        html = REPORT.report2html(reportTree, htmlFile)
        ARCPY.AddMessage(htmlFile)

        return htmlFile
コード例 #4
0
    def reportHTML(self, htmlFile = None):
        """Generates a graphical html report for Nearest Neighbor Stat."""

        #### Shorthand Attributes ####
        zScore = self.zn

        #### Progress and Create HTML File Name ####
        writeMSG = ARCPY.GetIDMessage(84228)
        ARCPY.SetProgressor("default", writeMSG)
        ARCPY.AddMessage(writeMSG)
        if not htmlFile:
            prefix = ARCPY.GetIDMessage(84240)
            outputDir = UTILS.returnScratchWorkSpace()
            baseDir = UTILS.getBaseFolder(outputDir)
            htmlFile = UTILS.returnScratchName(prefix, fileType = "TEXT", 
                                               scratchWS = baseDir,
                                               extension = "html")

        #### Obtain Correct Images ####
        imageDir = UTILS.getImageDir()
        clustStr = ARCPY.GetIDMessage(84243)
        dispStr = ARCPY.GetIDMessage(84244)
        if zScore <= -2.58:
            imageFile = OS.path.join(imageDir, "clusteredPoints01.png")
            info = ("1%", clustStr)
            imageBox = OS.path.join(imageDir, "dispersedBox01.png")
        elif (-2.58 < zScore <= -1.96):
            imageFile = OS.path.join(imageDir, "clusteredPoints05.png")
            info = ("5%", clustStr)
            imageBox = OS.path.join(imageDir, "dispersedBox05.png")
        elif (-1.96 < zScore <= -1.65):
            imageFile = OS.path.join(imageDir, "clusteredPoints10.png")
            info = ("10%", clustStr)
            imageBox = OS.path.join(imageDir, "dispersedBox10.png")
        elif (-1.65 < zScore < 1.65):
            imageFile = OS.path.join(imageDir, "randomPoints.png")
            imageBox = OS.path.join(imageDir, "randomBox.png")
        elif (1.65 <= zScore < 1.96):
            imageFile = OS.path.join(imageDir, "dispersedPoints10.png")
            info = ("10%", dispStr)
            imageBox = OS.path.join(imageDir, "clusteredBox10.png")
        elif (1.96 <= zScore < 2.58):
            imageFile = OS.path.join(imageDir, "dispersedPoints05.png")
            info = ("5%", dispStr)
            imageBox = OS.path.join(imageDir, "clusteredBox05.png")
        else:
            imageFile = OS.path.join(imageDir, "dispersedPoints01.png")
            info = ("1%", dispStr)
            imageBox = OS.path.join(imageDir, "clusteredBox01.png")

        #### Footnote ####
        footStart = ARCPY.GetIDMessage(84230).format(zScore)
        if abs(zScore) >= 1.65:
            footEnd = ARCPY.GetIDMessage(84231)
            footEnd = footEnd.format(*info)
            footerText = footStart + footEnd 
        else:
            footEnd = ARCPY.GetIDMessage(84232)
            footerText = footStart + footEnd

        #### Root Element ####
        title = ARCPY.GetIDMessage(84161)
        reportElement, reportTree = REPORT.xmlReport(title = title)

        #### Begin Graphic SubElement ####
        graphicElement = REPORT.xmlGraphic(reportElement, imageFile, 
                                           footerText = footerText)

        #### Floating Table ####
        rowVals = [ [ARCPY.GetIDMessage(84164), self.ratioString, ""],
                    [ARCPY.GetIDMessage(84151), self.znString, imageBox],
                    [ARCPY.GetIDMessage(84152), self.pvString, ""] ]

        fTable = REPORT.xmlTable(graphicElement, rowVals, 
                                 tType = "ssFloat")

        #### NN Table ####
        rowVals = [ [ARCPY.GetIDMessage(84162), self.nnStringD],
                    [ARCPY.GetIDMessage(84163), self.enStringD],
                    [ARCPY.GetIDMessage(84164), self.ratioString],
                    [ARCPY.GetIDMessage(84151), self.znString],
                    [ARCPY.GetIDMessage(84152), self.pvString] ]

        nnTable = REPORT.xmlTable(reportElement, rowVals,
                                  title = ARCPY.GetIDMessage(84161))

        #### Dataset Table ####
        rowVals = [ [UTILS.addColon(ARCPY.GetIDMessage(84233)), 
                     self.ssdo.inputFC],
                    [UTILS.addColon(ARCPY.GetIDMessage(84235)),
                     self.concept],
                    [UTILS.addColon(ARCPY.GetIDMessage(84241)), 
                     LOCALE.format("%0.6f", self.studyArea)],
                    [UTILS.addColon(ARCPY.GetIDMessage(84418)),
                     str(self.ssdo.selectionSet)] ]

        dTable = REPORT.xmlTable(reportElement, rowVals,
                         title = ARCPY.GetIDMessage(84239))

        #### Create HTML ####
        html = REPORT.report2html(reportTree, htmlFile)
        ARCPY.AddMessage(htmlFile)

        return htmlFile