# ---------------------------------------------------------------------- # CreateHistogramForInterval proc CreateHistogramForInterval {title intervalSize unit numberOfInterval filePath histogramSwitchNumber position} { set tickTable(5) 5 set tickTable(10) 11 set tickTable(20) 11 switch $histogramSwitchNumber 1 { set bar {bar d1 width 1 fill violet} } 2 { set bar {bar d1,d2 width 0.18 fill violet,aquamarine} } 3 { set bar {bar d1,d2,d3 width 0.18 fill moccasin,violet,aquamarine} } set gleProgram { size 12 8 set font texcmr set lwidth .002 amove 0 0.2 begin graph title "$title" xtitle "Interval ([expr int($intervalSize)] $unit)" ytitle "Percent of pixels" xaxis nticks $tickTable($numberOfInterval) xticks off yaxis grid key position $position data "$filePath" $bar end graph } return [subst $gleProgram] } # CreateHistogramForInterval - end # ---------------------------------------------------------------------- # CreateHistogramForClass proc CreateHistogramForClass {title filePath histogramSwitchNumber} { upvar classNameArray classNameArray switch $histogramSwitchNumber 1 { set bar {bar d1 width .8 fill violet} } 2 { set bar {bar d1,d2 width 0.18 fill violet,aquamarine} } 3 { set bar {bar d1,d2,d3 width 0.18 fill moccasin,violet,aquamarine} } set classNameList {} foreach name [lsort -dictionary [array names classNameArray]] { lappend classNameList "text \"$name - $classNameArray($name)\"" } set numberOfClass [llength $classNameList] set deltaY [expr $numberOfClass*(0.26 + 0.052) + 0.4] set gleProgram { size 13.2 [expr 6 + $deltaY] set font texcmr set lwidth .002 amove 0 $deltaY begin graph size 12 6 title "$title" xtitle "Class" ! ytitle "Total of pixels" ytitle "Percent of pixels" xaxis nticks 21 dticks 0.2 xnames [lsort -dictionary [array names classNameArray]] xlabels hei .3 xticks off ylabels hei .3 ! yaxis format "sci 1 10" grid yaxis grid key position tr key offset -0.1 0 data "$filePath" $bar end graph begin key justify bc absolute 0.2+(pagewidth()/2) 0.4 hei 0.26 nobox boxcolor clear [join $classNameList \n] end key } return [subst $gleProgram] } # CreateHistogramForClass - end # ---------------------------------------------------------------------- # ComputeHistogramRecursively proc ComputeHistogramRecursively {varName histogramArrayName noDataCounterName noData lowerBound upperBound numberOfInterval intervalSize} { upvar $varName var upvar 3 $histogramArrayName histogramArray upvar 3 $noDataCounterName noDataCounter foreach value $var { if [expr $value == $noData] {incr noDataCounter; continue} ;# -9999.0 == -9999 if [expr $value < $lowerBound || $value > $upperBound] {continue} incr histogramArray([expr int(($value - $lowerBound)/$intervalSize)]) } return 0 } # ComputeHistogramRecursively - end # ---------------------------------------------------------------------- # ComputeHistogram # proc ComputeHistogram {fileSequence resultDirectory {lowerBound {}} {upperBound {}} {numberOfInterval {}} {unit {}} {cumulativeHistogramFlag 0} {noData {}}} # proc ComputeHistogram {fileSequence resultDirectory} { global homePath global env upvar histogramArray histogramArray upvar noDataCounter noDataCounter # upvar gleCumulativeData2Array gleCumulativeData2Array foreach {variableName defaultValue} {lowerBound {} upperBound {} numberOfInterval {} unit {} cumulativeHistogramFlag 0 noData {} newTitle {}} { upvar $variableName $variableName if ![info exists $variableName] {set $variableName $defaultValue} } set argv 0 source ../../../../../urlib.net/www/2021/07.02.22.22/doc/GetSizeRecursively.tcl set env(URLIB_SERVICE_REP) dpi.inpe.br/banon/1998/08.02.08.56 set glePath [SetPath gle] # puts $glePath set qglePath [SetPath qgle] set errorMessage {} set histogramSwitchNumber [llength $fileSequence] switch $histogramSwitchNumber 1 { } 2 { set prefix {} if [info exists gleData2Array] {unset gleData2Array} ;# used to create file2Path3 if $cumulativeHistogramFlag { if [info exists gleCumulativeData2Array] {unset gleCumulativeData2Array} ;# used to create file2Path5 } } 3 { if [info exists gleData3Array] {unset gleData3Array} ;# used to create file3Path3 } set sampleNumberList {} foreach {filePath} $fileSequence { set theme [file rootname [file tail $filePath]] if [string equal {.tcl} [file extension $filePath]] { source $filePath ;# might set lowerBound and other variables or arrays (histogramArray) regsub {\(histogram\).*} $theme {} theme } if [info exists gleDataArray] {unset gleDataArray} ;# used to create filePath3 if $cumulativeHistogramFlag { if [info exists gleCumulativeDataArray] {unset gleCumulativeDataArray} ;# used to create filePath5 } if [string equal {} $lowerBound] { # class regexp {_(.*?)_} $theme m title if ![string equal {} $newTitle] {set title $newTitle} regexp {_(.*)} $theme m sufix set filePath1 $homePath/col/$resultDirectory/doc/${theme}(histogram).tcl ;# tcl result set filePath2 $homePath/col/$resultDirectory/doc/${theme}(histogram).txt ;# textual result set filePath3 $homePath/col/$resultDirectory/doc/${theme}(histogram).dat ;# graphical result set filePath4 $homePath/col/$resultDirectory/doc/${theme}(histogram).gle ;# gle program } else { # interval set intervalSize [expr ($upperBound - $lowerBound)/$numberOfInterval] regexp {_masc.*?-(.*?)_} $theme m title regexp {_(masc.*)} $theme m sufix # theme: MPO_mascara25-uniao-hidrografia-area-aberta-MapBiomas_32723 # title: uniao-hidrografia-area-aberta-MapBiomas # sufix: mascara25-uniao-hidrografia-area-aberta-MapBiomas_32723 set filePath1 $homePath/col/$resultDirectory/doc/${theme}(histogram)($lowerBound-$upperBound)($numberOfInterval).tcl ;# tcl result set filePath2 $homePath/col/$resultDirectory/doc/${theme}(histogram)($lowerBound-$upperBound)($numberOfInterval).txt ;# textual result set filePath3 $homePath/col/$resultDirectory/doc/${theme}(histogram)($lowerBound-$upperBound)($numberOfInterval).dat ;# graphical result set filePath4 $homePath/col/$resultDirectory/doc/${theme}(histogram)($lowerBound-$upperBound)($numberOfInterval).gle ;# gle program if $cumulativeHistogramFlag { set filePath5 $homePath/col/$resultDirectory/doc/${theme}(cumulative_histogram)($lowerBound-$upperBound)($numberOfInterval).dat ;# graphical result set filePath6 $homePath/col/$resultDirectory/doc/${theme}(cumulative_histogram)($lowerBound-$upperBound)($numberOfInterval).gle ;# gle program } } # Recursive processing switch $histogramSwitchNumber 1 { # file delete $filePath1 file delete $filePath2 file delete $filePath3 file delete $filePath4 if $cumulativeHistogramFlag { file delete $filePath5 file delete $filePath6 } } 2 { lappend prefix [lindex [split $theme _] 0] } 3 { } # Create filePath1 (tcl) if [file exists $filePath1] { if {![string equal {.tcl} [file extension $filePath]]} { set cumulativeHistogramFlag2 $cumulativeHistogramFlag source $filePath1 ;# might set lowerBound and other variables or arrays (histogramArray) set cumulativeHistogramFlag $cumulativeHistogramFlag2 } } else { set initial [clock milliseconds] set initial2 "set initial $initial" Store initial2 $filePath1 if [info exists histogramArray] {unset histogramArray} for {set i 0} {$i <= $numberOfInterval} {incr i} { set histogramArray($i) 0 ;# some interval might stay empty } foreach line [GetHeader $filePath] { foreach {name value} $line {break} if [string equal -nocase nodata_value $name] {set noData $value; break} } # if ![info exists noData] {set noData 0} foreach variableName {lowerBound upperBound numberOfInterval unit cumulativeHistogramFlag noData} { if [info exists $variableName] { set line "set $variableName [set $variableName]" Store line $filePath1 auto 0 a } } set noDataCounter 0 set action "ComputeHistogramRecursively var histogramArray noDataCounter $noData $lowerBound $upperBound $numberOfInterval $intervalSize" set action2 "set action {$action}" Store action2 $filePath1 auto 0 a if ![file exists $filePath] { set errorMessage "$filePath not found" break } # ACTION ProcessRecursively $filePath $action incr histogramArray([expr $numberOfInterval - 1]) $histogramArray($numberOfInterval) set noDataCounter2 "set noDataCounter $noDataCounter" Store noDataCounter2 $filePath1 auto 0 a StoreArray histogramArray $filePath1 a list set final [clock milliseconds] set final2 "set final $final" Store final2 $filePath1 auto 0 a } # Create filePath1 (tcl) - end set histogramIntegral 0 set valueList {} set maxNameLength 0 foreach name [array names histogramArray] { incr histogramIntegral $histogramArray($name) lappend valueList $histogramArray($name) set nameLength [string length $name] if {$nameLength > $maxNameLength} {set maxNameLength $nameLength} } set maxValue [lindex [lsort -integer $valueList] end] set maxValueLength [string length $maxValue] lappend sampleNumberList $histogramIntegral if [info exists totalOfPixels] {set histogramIntegral $totalOfPixels} # Create filePath2 (txt) if ![file exists $filePath2] { # store filePath2 if [info exists action] { # an action was performed # header set lineList [list \ "date = [clock format [clock seconds] -format %Y-%m-%d]" \ "localtime = [clock format [clock seconds] -format %H:%M:%S]" \ "file path = $filePath" \ "action = [lindex $action 0]" \ "lowerBound = $lowerBound" \ "upperBound = $upperBound" \ "numberOfInterval = $numberOfInterval" \ "intervalSize = $intervalSize" \ "unit = $unit" \ ] foreach line $lineList { Store line $filePath2 auto 0 a } set line "noData = $noData" Store line $filePath2 auto 0 a set line "noDataCounter = $noDataCounter" Store line $filePath2 auto 0 a set line [DisplayProcessingTime [expr $final - $initial]] Store line $filePath2 auto 0 a # textual and graphical data set upperBoundLength [string length [expr int($upperBound)].0] if $cumulativeHistogramFlag { # histogram + cumulative histogram set integralValueLength [string length $histogramIntegral] set cumulativeData 0 for {set i 0} {$i < $numberOfInterval} {incr i} { incr cumulativeData $histogramArray($i) set j [expr $i + 1] if {$i == [expr $numberOfInterval - 1]} { set line "[format "%3s %${maxValueLength}s %5.1f" $j $histogramArray($i) [expr 100*$histogramArray($i)/$histogramIntegral.]]% [format "%${integralValueLength}s %5.1f" $cumulativeData [expr 100*$cumulativeData/$histogramIntegral.]]% [format "\[%$upperBoundLength.1f, %$upperBoundLength.1f\]" [expr $i*$intervalSize] [expr ($i + 1)*$intervalSize]]" } else { set line "[format "%3s %${maxValueLength}s %5.1f" $j $histogramArray($i) [expr 100*$histogramArray($i)/$histogramIntegral.]]% [format "%${integralValueLength}s %5.1f" $cumulativeData [expr 100*$cumulativeData/$histogramIntegral.]]% [format "\[%$upperBoundLength.1f, %$upperBoundLength.1f\[" [expr $i*$intervalSize] [expr ($i + 1)*$intervalSize]]" } Store line $filePath2 auto 0 a } } else { # histogram for {set i 0} {$i < $numberOfInterval} {incr i} { set j [expr $i + 1] if {$i == [expr $numberOfInterval - 1]} { set line "[format "%3s %${maxValueLength}s %5.1f" $j $histogramArray($i) [expr 100*$histogramArray($i)/$histogramIntegral.]]% [format "\[%$upperBoundLength.1f, %$upperBoundLength.1f\]" [expr $i*$intervalSize] [expr ($i + 1)*$intervalSize]]" } else { set line "[format "%3s %${maxValueLength}s %5.1f" $j $histogramArray($i) [expr 100*$histogramArray($i)/$histogramIntegral.]]% [format "\[%$upperBoundLength.1f, %$upperBoundLength.1f\[" [expr $i*$intervalSize] [expr ($i + 1)*$intervalSize]]" } Store line $filePath2 auto 0 a } } } else { # no action was performed # header set lineList [list \ "date = [clock format [clock seconds] -format %Y-%m-%d]" \ "localtime = [clock format [clock seconds] -format %H:%M:%S]" \ "file path = $filePath1" \ ] foreach line $lineList { Store line $filePath2 auto 0 a } # textual and graphical data foreach name [lsort -dictionary [array names histogramArray]] { set line [format " %${maxNameLength}s %${maxValueLength}s %5.1f" $name $histogramArray($name) [expr 100*$histogramArray($name)/$histogramIntegral.]]% Store line $filePath2 auto 0 a } } } # Create filePath2 (txt) - end # Create filePath3 (dat) if ![file exists $filePath3] { # store filePath3 set gleHeaderLine [format "\"%${maxNameLength}s\", \"%4s\"" 0 [lindex [split $theme _] 0]] Store gleHeaderLine $filePath3 if [string equal {} $lowerBound] { # class set classNameList {} foreach name [lsort -dictionary [array names histogramArray]] { set gleLine [format "\"%${maxNameLength}s\", %5.1f" $name [expr 100*$histogramArray($name)/$histogramIntegral.]] Store gleLine $filePath3 auto 0 a } } else { # interval for {set i 0} {$i < $numberOfInterval} {incr i} { set j [expr $i + 1] set gleDataArray($j) [expr 100*$histogramArray($i)/$histogramIntegral.] } foreach name [lsort -integer [array names gleDataArray]] { set gleLine [format "\"%${maxNameLength}s\", %5.1f" $name $gleDataArray($name)] Store gleLine $filePath3 auto 0 a } } } # Create filePath3 (dat) - end # Create filePath5 (dat) if {$cumulativeHistogramFlag && ![file exists $filePath5]} { # store filePath5 set cumulativeData 0 for {set i 0} {$i < $numberOfInterval} {incr i} { incr cumulativeData $histogramArray($i) set j [expr $i + 1] set gleCumulativeDataArray($j) [expr 100*$cumulativeData/$histogramIntegral.] } set gleHeaderLine [format "\"%${maxNameLength}s\", \"%4s\"" 0 [lindex [split $theme _] 0]] Store gleHeaderLine $filePath5 foreach name [lsort -integer [array names gleCumulativeDataArray]] { set gleLine [format "\"%${maxNameLength}s\", %5.1f" $name $gleCumulativeDataArray($name)] Store gleLine $filePath5 auto 0 a } } # Create filePath5 (dat) - end # Create filePath4 (gle and pdf) if ![file exists $filePath4] { # GLE program - one histogram if [string equal {} $lowerBound] { # class set gleProgram [CreateHistogramForClass $title $filePath3 1] } else { # interval set gleProgram [CreateHistogramForInterval $title $intervalSize $unit $numberOfInterval $filePath3 1 tr] } Store gleProgram $filePath4 # GLE program - one histogram - end # GLE program execution # set option {-d jpg -r 200 -vb 0} set option {-d pdf -vb 0} eval exec [list $glePath] $option [list $filePath4] # GLE program execution - end } # Create filePath4 (gle and pdf) - end # cumulative # Create filePath6 (gle and pdf) if {$cumulativeHistogramFlag && ![file exists $filePath6]} { # GLE program - one cumulative histogram set gleProgram [CreateHistogramForInterval $title $intervalSize $unit $numberOfInterval $filePath5 1 tl] Store gleProgram $filePath6 # GLE program - one cumulative histogram - end # GLE program execution # set option {-d jpg -r 200 -vb 0} set option {-d pdf -vb 0} eval exec [list $glePath] $option [list $filePath6] # GLE program execution - end # Create filePath6 (gle and pdf) - end } switch $histogramSwitchNumber 1 { } 2 { set columnLabel [lindex [split $theme _] 0] if [info exists newColumnLabel] {set columnLabel $newColumnLabel} lappend gleData2Array(0) $columnLabel ;# MCP_masc-dist-agua-aberta-cana_GRR -> MCP if $cumulativeHistogramFlag { lappend gleCumulativeData2Array(0) [lindex [split $theme _] 0] ;# MCP_masc-dist-agua-aberta-cana_GRR -> MCP } if [string equal {} $lowerBound] { # class foreach name [array names histogramArray] { lappend gleData2Array($name) [expr 100*$histogramArray($name)/$histogramIntegral.] } } else { # interval for {set i 0} {$i < $numberOfInterval} {incr i} { set j [expr $i + 1] lappend gleData2Array($j) [expr 100*$histogramArray($i)/$histogramIntegral.] } if $cumulativeHistogramFlag { set cumulativeData 0 for {set i 0} {$i < $numberOfInterval} {incr i} { incr cumulativeData $histogramArray($i) set j [expr $i + 1] lappend gleCumulativeData2Array($j) [expr 100*$cumulativeData/$histogramIntegral.] } } } } 3 { set columnLabel [lindex [split $theme _] 0] if [info exists newColumnLabel] {set columnLabel $newColumnLabel} lappend gleData3Array(0) $columnLabel ;# MCP_masc-dist-agua-aberta-cana_GRR -> MCP if [string equal {} $lowerBound] { # class foreach name [array names histogramArray] { lappend gleData3Array($name) [expr 100*$histogramArray($name)/$histogramIntegral.] } } else { # interval for {set i 0} {$i < $numberOfInterval} {incr i} { set j [expr $i + 1] # lappend gleData3Array($j) $histogramArray($i) lappend gleData3Array($j) [expr 100*$histogramArray($i)/$histogramIntegral.] } } } } ;# foreach end # Create file2Path3 (dat) # Create file3Path3 (dat) switch $histogramSwitchNumber 1 { } 2 { set prefix [join $prefix -] if [string equal {} $lowerBound] { # class set file2Path3 $homePath/col/$resultDirectory/doc/$prefix-${sufix}(histogram).dat ;# graphical result set file2Path4 $homePath/col/$resultDirectory/doc/$prefix-${sufix}(histogram).gle ;# gle program } else { # interval set file2Path3 $homePath/col/$resultDirectory/doc/$prefix-${sufix}(histogram)($lowerBound-$upperBound)($numberOfInterval).dat ;# graphical result set file2Path4 $homePath/col/$resultDirectory/doc/$prefix-${sufix}(histogram)($lowerBound-$upperBound)($numberOfInterval).gle ;# gle program if $cumulativeHistogramFlag { # Kolmogorov-Smirnov test set file2Path2 $homePath/col/$resultDirectory/doc/$prefix-${sufix}(cumulative_histogram)($lowerBound-$upperBound)($numberOfInterval).txt ;# Kolmogorov-Smirnov test result file delete $file2Path2 # using intervals set line {Using intervals} Store line $file2Path2 set absDifList {} foreach name [array names gleCumulativeData2Array -regexp {^[^0]}] { foreach {cumulativeFrequency1 cumulativeFrequency2} $gleCumulativeData2Array($name) {break} lappend absDifList [list $name [expr abs($cumulativeFrequency1 - $cumulativeFrequency2)]] } foreach {n D} [lindex [lsort -real -index 1 $absDifList] end] {break} set line "v = [format %6.1f [expr ($n - 0.5)*$intervalSize]]" Store line $file2Path2 auto 0 a set D [expr $D/100] set line "D = [format %6.4f $D]" Store line $file2Path2 auto 0 a set alphaArray(0.1) 1.22 set alphaArray(0.05) 1.36 set alphaArray(0.025) 1.48 set alphaArray(0.01) 1.63 set alphaArray(0.005) 1.73 set alphaArray(0.001) 1.95 foreach {n1 n2} $sampleNumberList {break} foreach alpha [lsort -real -decreasing [array names alphaArray]] { set rejectionLevel [expr $alphaArray($alpha)*sqrt(double($n1 + $n2)/($n1*$n2))] set line "alpha = [format %5.3f $alpha]; rejection level = [format %.3f $rejectionLevel]; test result: [expr $D < $rejectionLevel?{accept H0}:{reject H0}]" Store line $file2Path2 auto 0 a } set line {} Store line $file2Path2 auto 0 a # without any intervals set line {Without any intervals} Store line $file2Path2 auto 0 a set i 1 foreach {filePath} $fileSequence { Load $filePath valueList$i incr i } set n1 [llength $valueList1] set n2 [llength $valueList2] set valueList [concat $valueList1 $valueList2] set valueList [lsort -unique -real $valueList] if [info exists histogram1Array] {unset histogram1Array} if [info exists histogram2Array] {unset histogram2Array} foreach value $valueList { set histogram1Array($value) 0 set histogram2Array($value) 0 } foreach value $valueList1 { incr histogram1Array($value) } foreach value $valueList2 { incr histogram2Array($value) } set cumulativeFrequency1 0 set cumulativeFrequency2 0 set absDifList {} foreach value $valueList { incr cumulativeFrequency1 $histogram1Array($value) incr cumulativeFrequency2 $histogram2Array($value) lappend absDifList [list $value [expr abs(double($cumulativeFrequency1)/$n1 - double($cumulativeFrequency2)/$n2)]] } foreach {v D} [lindex [lsort -real -index 1 $absDifList] end] {break} set line "v = [format %6.1f $v]" Store line $file2Path2 auto 0 a set line "D = [format %6.4f $D]" Store line $file2Path2 auto 0 a foreach alpha [lsort -real -decreasing [array names alphaArray]] { set rejectionLevel [expr $alphaArray($alpha)*sqrt(double($n1 + $n2)/($n1*$n2))] set line "alpha = [format %5.3f $alpha]; rejection level = [format %.3f $rejectionLevel]; test result: [expr $D < $rejectionLevel?{accept H0}:{reject H0}]" Store line $file2Path2 auto 0 a } # Kolmogorov-Smirnov test - end set file2Path5 $homePath/col/$resultDirectory/doc/$prefix-${sufix}(cumulative_histogram)($lowerBound-$upperBound)($numberOfInterval).dat ;# graphical result set file2Path6 $homePath/col/$resultDirectory/doc/$prefix-${sufix}(cumulative_histogram)($lowerBound-$upperBound)($numberOfInterval).gle ;# gle program } } file delete $file2Path3 file delete $file2Path4 foreach name [lsort -integer [array names gleData2Array]] { set gleLine [format "\"%3s\", %3s" $name [join $gleData2Array($name) {, }]] Store gleLine $file2Path3 auto 0 a } if $cumulativeHistogramFlag { file delete $file2Path5 file delete $file2Path6 foreach name [lsort -integer [array names gleCumulativeData2Array]] { set gleLine [format "\"%3s\", %3s" $name [join $gleCumulativeData2Array($name) {, }]] Store gleLine $file2Path5 auto 0 a } } } 3 { if [string equal {} $lowerBound] { # class set file3Path3 $homePath/col/$resultDirectory/doc/${sufix}(histogram).dat ;# graphical result set file3Path4 $homePath/col/$resultDirectory/doc/${sufix}(histogram).gle ;# gle program } else { # interval set file3Path3 $homePath/col/$resultDirectory/doc/${sufix}(histogram)($lowerBound-$upperBound)($numberOfInterval).dat ;# graphical result set file3Path4 $homePath/col/$resultDirectory/doc/${sufix}(histogram)($lowerBound-$upperBound)($numberOfInterval).gle ;# gle program } file delete $file3Path3 file delete $file3Path4 foreach name [lsort -integer [array names gleData3Array]] { set gleLine [format "\"%3s\", %3s" $name [join $gleData3Array($name) {, }]] Store gleLine $file3Path3 auto 0 a } } # Create file2Path3 (dat) - end # Create file3Path3 (dat) - end if [string equal {} $errorMessage] { # GLE program execution switch $histogramSwitchNumber 1 { # set option {-d jpg -r 200 -vb 0} # eval exec [list $glePath] $option [list $filePath4] eval exec [list $qglePath] -vb 0 [list $filePath4] & if $cumulativeHistogramFlag { eval exec [list $qglePath] -vb 0 [list $filePath6] & } Load $filePath2 fileContent puts $fileContent } 2 { # GLE program - two histograms if [string equal {} $lowerBound] { # class set gleProgram [CreateHistogramForClass $title $file2Path3 2] } else { # interval set gleProgram [CreateHistogramForInterval $title $intervalSize $unit $numberOfInterval $file2Path3 2 tr] } Store gleProgram $file2Path4 if $cumulativeHistogramFlag { set gleProgram [CreateHistogramForInterval $title $intervalSize $unit $numberOfInterval $file2Path5 2 tl] Store gleProgram $file2Path6 } # GLE program - three histograms - end # set option {-d jpg -r 200 -vb 0} set option {-d pdf -vb 0} eval exec [list $glePath] $option [list $file2Path4] eval exec [list $qglePath] -vb 0 [list $file2Path4] & if $cumulativeHistogramFlag { eval exec [list $glePath] $option [list $file2Path6] eval exec [list $qglePath] -vb 0 [list $file2Path6] & } Load $file2Path2 fileContent puts $fileContent } 3 { # GLE program - three histograms if [string equal {} $lowerBound] { # class set gleProgram [CreateHistogramForClass $title $file3Path3 3] } else { # interval set gleProgram [CreateHistogramForInterval $title $intervalSize $unit $numberOfInterval $file3Path3 3 tr] } Store gleProgram $file3Path4 # GLE program - three histograms - end # set option {-d jpg -r 200 -vb 0} set option {-d pdf -vb 0} eval exec [list $glePath] $option [list $file3Path4] eval exec [list $qglePath] -vb 0 [list $file3Path4] & } # GLE program execution - end } else { puts $errorMessage } } # ComputeHistogram end # ---------------------------------------------------------------------- if $argv { # usage examples console show source ../../../../../dpi.inpe.br/banon/1998/08.02.08.56/doc/utilities1.tcl ;# Store and StoreArray source ../../../../../dpi.inpe.br/banon/1998/08.02.08.56/doc/cgi/mirrorfind-.tcl ;# Load regexp "(^.*)/col/" [pwd] m homePath set imageDirectory ../../../../../urlib.net/www/2021/07.14.21.56/doc set resultRepository urlib.net/www/2021/07.14.21.56 set switchNumber 6.3 switch $switchNumber 1 { set filePath $imageDirectory/arquivo_masc-Teste_.txt set lowerBound 0 set upperBound 3552.935059 set numberOfInterval 5 set numberOfInterval 10 set numberOfInterval 20 set unit m set cumulativeHistogramFlag 1 set fileSequence [list $filePath] } 2 { set filePath $imageDirectory/_masc-distCanaArAbertaAgua_MB2016F5x5_GRR.txt set lowerBound 0 set upperBound 22660.839844 set numberOfInterval 20 set fileSequence [list $filePath] set unit m } 3 { set filePath $imageDirectory/MCP_masc-dist-agua-aberta-cana_GRR.txt set lowerBound 0 set upperBound 161935.890625 set upperBound 8096.8 set upperBound 3148.8 set upperBound 4883.8 set upperBound 161935.890625 set numberOfInterval 20 set unit m set fileSequence [list $filePath] } 4 { set filePath $imageDirectory/SP_masc-dist-agua-aberta-cana_GRR.txt set lowerBound 0 set upperBound 325588.531250 set upperBound 16279.4 set upperBound 4883.8 set numberOfInterval 20 set unit m set fileSequence [list $filePath] } 5 { set filePath1 $imageDirectory/arquivo_masc-Teste_.txt set filePath2 $imageDirectory/arquivo2_masc-Teste_.txt set filePath3 $imageDirectory/arquivo3_masc-Teste_.txt set lowerBound 0 set upperBound 3552.935059 set numberOfInterval 20 set unit m # set cumulativeHistogramFlag 1 ;# not used - used only with two files set fileSequence [list $filePath1 $filePath2 $filePath3] } 6 { set filePath $imageDirectory/MPO_mascara-distancia-presenca-agua-area-aberta-cana-F5x5_32723.asc set lowerBound 0 set upperBound 9000 set numberOfInterval 20 set unit m set fileSequence [list $filePath] } 6.1 { set filePath $imageDirectory/MPO_mascara-distancia-presenca-agua-area-aberta-cana-F5x5_32723(extrated_sample)(1000)(183305)(0-9000).asc set lowerBound 0 set upperBound 9000 set numberOfInterval 20 set unit m set noData -9999 set fileSequence [list $filePath] } 6.2 { set filePath $imageDirectory/MCP_mascara-distancia-presenca-agua-area-aberta-cana-F5x5_32723(extrated_sample)(1000)(7919)(0-9000).asc set lowerBound 0 set upperBound 9000 set numberOfInterval 20 set unit m set noData -9999 set fileSequence [list $filePath] } 6.3 { set filePath1 $imageDirectory/MPO_mascara-distancia-presenca-agua-area-aberta-cana-F5x5_32723(extrated_sample)(1000)(183305)(0-9000).asc set filePath2 $imageDirectory/MCP_mascara-distancia-presenca-agua-area-aberta-cana-F5x5_32723(extrated_sample)(1000)(7919)(0-9000).asc set lowerBound 0 set upperBound 9000 set numberOfInterval 20 set unit m set cumulativeHistogramFlag 1 set noData -9999 set fileSequence [list $filePath1 $filePath2] } 7 { set filePath $imageDirectory/MCP_mascara-porcentagem-formacao-florestal-F7x7_32723.asc set lowerBound 0 set upperBound 100 set numberOfInterval 10 set unit % set fileSequence [list $filePath] } 8 { set filePath $imageDirectory/MCP_pixels-classes-cobertura-Terra-mapbiomas2016_ ;# don't need to exist if .tcl exists set filePath $imageDirectory/MPO_pixels-classes-cobertura-Terra-mapbiomas2016_ ;# don't need to exist if .tcl exists set filePath $imageDirectory/SP_pixels-classes-cobertura-Terra-mapbiomas2016_(histogram).tcl set fileSequence [list $filePath] } 9 { set filePath1 $imageDirectory/MCP_pixels-classes-cobertura-Terra-mapbiomas2016_(histogram).tcl set filePath2 $imageDirectory/MPO_pixels-classes-cobertura-Terra-mapbiomas2016_ ;# don't need to exist if .tcl exists set filePath3 $imageDirectory/SP_pixels-classes-cobertura-Terra-mapbiomas2016_ ;# don't need to exist if .tcl exists set fileSequence [list $filePath1 $filePath2 $filePath3] } 10 { set filePath $imageDirectory/MCP_mascara-porcentagem-formacao-florestal-F7x7_32723(extrated_sample)(8000)(183305)(0-100).asc set filePath $imageDirectory/MCP_mascara-porcentagem-formacao-florestal-F7x7_32723(extrated_sample)(1000)(183305)(0-100).asc set lowerBound 0 set upperBound 100 set numberOfInterval 10 set unit % set noData -9999 set fileSequence [list $filePath] } 11 { set filePath $imageDirectory/arquivo_masc-Teste_(histogram)(0-3552.935059)(20).tcl ;# don't need to exist if .tcl exists set fileSequence [list $filePath] } 12 { set filePath1 $imageDirectory/SP2013_pixels-classes-interesse-cobertura-Terra-mapbiomas_(histogram).tcl set filePath2 $imageDirectory/SPestavel_pixels-classes-interesse-cobertura-Terra-mapbiomas_(histogram).tcl set filePath3 $imageDirectory/SP2018_pixels-classes-interesse-cobertura-Terra-mapbiomas_(histogram).tcl set newTitle {Land cover classes from MapBiomas} set fileSequence [list $filePath1 $filePath2 $filePath3] } ComputeHistogram $fileSequence $resultRepository } # Previous textual results if 0 { file path = arquivo_masc-Teste_ action = ComputeHistogramRecursively lowerBound = 0 upperBound = 3552.935059 numberOfInterval = 20 intervalSize = 177.64675295 m noData = 3.402823466e+038 noDataCounter = 0 processing time = 8 ms 1 43 4.2% [ 0.0, 177.6[ 2 69 6.7% [ 177.6, 355.3[ 3 73 7.1% [ 355.3, 532.9[ 4 99 9.7% [ 532.9, 710.6[ 5 121 11.8% [ 710.6, 888.2[ 6 68 6.6% [ 888.2, 1065.9[ 7 73 7.1% [1065.9, 1243.5[ 8 90 8.8% [1243.5, 1421.2[ 9 47 4.6% [1421.2, 1598.8[ 10 44 4.3% [1598.8, 1776.5[ 11 46 4.5% [1776.5, 1954.1[ 12 37 3.6% [1954.1, 2131.8[ 13 28 2.7% [2131.8, 2309.4[ 14 37 3.6% [2309.4, 2487.1[ 15 69 6.7% [2487.1, 2664.7[ 16 36 3.5% [2664.7, 2842.3[ 17 15 1.5% [2842.3, 3020.0[ 18 10 1.0% [3020.0, 3197.6[ 19 10 1.0% [3197.6, 3375.3[ 20 9 0.9% [3375.3, 3552.9] }