Skip to content

Commit

Permalink
7.9.4
Browse files Browse the repository at this point in the history
  • Loading branch information
semiautomaticgit committed Jul 24, 2021
1 parent 21d4f68 commit f50da4c
Show file tree
Hide file tree
Showing 26 changed files with 23,384 additions and 23,379 deletions.
2 changes: 1 addition & 1 deletion __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def description():


def version():
return 'Version 7.9.3 - Matera'
return 'Version 7.9.4 - Matera'


def icon():
Expand Down
4 changes: 2 additions & 2 deletions docs/repository.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version = '1.0' encoding = 'UTF-8'?>
<plugins>
<pyqgis_plugin name="Semi-Automatic Classification Plugin - master" version="7.9.3" plugin_id="284">
<pyqgis_plugin name="Semi-Automatic Classification Plugin - master" version="7.9.4" plugin_id="284">
<description><![CDATA[The Semi-Automatic Classification Plugin (SCP) allows for the supervised classification of remote sensing images, providing tools for the download, the preprocessing and postprocessing of images.]]></description>
<about><![CDATA[Developed by Luca Congedo, the Semi-Automatic Classification Plugin (SCP) allows for the supervised classification of remote sensing images, providing tools for the download, the preprocessing and postprocessing of images. Search and download is available for ASTER, GOES, Landsat, MODIS, Sentinel-1, Sentinel-2, and Sentinel-3 images. Several algorithms are available for the land cover classification. This plugin requires the installation of GDAL, OGR, Numpy, SciPy, and Matplotlib. Some tools require also the installation of SNAP (ESA Sentinel Application Platform). For more information please visit https://fromgistors.blogspot.com .]]></about>
<version>7.9.3</version>
<version>7.9.4</version>
<qgis_minimum_version>3.0.0</qgis_minimum_version>
<qgis_maximum_version>3.99.0</qgis_maximum_version>
<homepage><![CDATA[https://fromgistors.blogspot.com/p/semi-automatic-classification-plugin.html]]></homepage>
Expand Down
84 changes: 42 additions & 42 deletions i18n/models/semiautomaticclassificationplugin.ts

Large diffs are not rendered by default.

84 changes: 42 additions & 42 deletions i18n/semiautomaticclassificationplugin.ts

Large diffs are not rendered by default.

84 changes: 42 additions & 42 deletions i18n/semiautomaticclassificationplugin_ar.ts

Large diffs are not rendered by default.

84 changes: 42 additions & 42 deletions i18n/semiautomaticclassificationplugin_de.ts

Large diffs are not rendered by default.

84 changes: 42 additions & 42 deletions i18n/semiautomaticclassificationplugin_el_GR.ts

Large diffs are not rendered by default.

84 changes: 42 additions & 42 deletions i18n/semiautomaticclassificationplugin_es.ts

Large diffs are not rendered by default.

84 changes: 42 additions & 42 deletions i18n/semiautomaticclassificationplugin_fr.ts

Large diffs are not rendered by default.

84 changes: 42 additions & 42 deletions i18n/semiautomaticclassificationplugin_it.ts

Large diffs are not rendered by default.

84 changes: 42 additions & 42 deletions i18n/semiautomaticclassificationplugin_ja.ts

Large diffs are not rendered by default.

84 changes: 42 additions & 42 deletions i18n/semiautomaticclassificationplugin_pl.ts

Large diffs are not rendered by default.

84 changes: 42 additions & 42 deletions i18n/semiautomaticclassificationplugin_pt.ts

Large diffs are not rendered by default.

84 changes: 42 additions & 42 deletions i18n/semiautomaticclassificationplugin_pt_BR.ts

Large diffs are not rendered by default.

84 changes: 42 additions & 42 deletions i18n/semiautomaticclassificationplugin_uk_UA.ts

Large diffs are not rendered by default.

84 changes: 42 additions & 42 deletions i18n/semiautomaticclassificationplugin_zh_CN.ts

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions maininterface/accuracy.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,10 @@ def errorMatrix(self, classification, reference, batch = 'No', shapefileField =
pixelTotal = {}
totPixelClass = 0
for i in sorted(reclRasterBandUniqueVal):
newRasterBandUniqueVal.append(i)
pixelTotal[i] = reclRasterBandUniqueVal[i]
totPixelClass = totPixelClass + reclRasterBandUniqueVal[i]
if NoDataValue != i:
newRasterBandUniqueVal.append(i)
pixelTotal[i] = reclRasterBandUniqueVal[i]
totPixelClass = totPixelClass + reclRasterBandUniqueVal[i]
bandsUniqueVal = [refRasterBandUniqueVal, newRasterBandUniqueVal]
if 0 in refRasterBandUniqueVal:
k0 = 1
Expand Down
4 changes: 2 additions & 2 deletions maininterface/bandcalcTab.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,15 +603,15 @@ def calculate(self, outFile = None, batch = 'No', expressionString = None, exten
if eN is None and len(check) == 1:
out = cfg.osSCP.path.dirname(outF) + '/' + n
elif eN is None and len(check) > 1:
out = cfg.osSCP.path.dirname(outF) + '/' + n.replace('.tif', '') + '_' + str(it) + '.tif'
out = cfg.osSCP.path.dirname(outF) + '/' + cfg.reSCP.sub(r'\.tif$', '', str(n)) + '_' + str(it) + '.tif'
else:
out = cfg.osSCP.path.dirname(outF) + '/' + n
elif n.lower().endswith('.vrt'):
vrtR = 'Yes'
if eN is None and len(check) == 1:
out = cfg.osSCP.path.dirname(outF) + '/' + n
elif eN is None and len(check) > 1:
out = cfg.osSCP.path.dirname(outF) + '/' + n.replace('.vrt', '') + '_' + str(it) + '.vrt'
out = cfg.osSCP.path.dirname(outF) + '/' + cfg.reSCP.sub(r'\.vrt$', '', str(n)) + '_' + str(it) + '.vrt'
else:
out = cfg.osSCP.path.dirname(outF) + '/' + n
else:
Expand Down
2 changes: 1 addition & 1 deletion maininterface/bandcombination.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def bandSetCombination(self, batch = 'No', bandSetNumber = None, rasterOutput =
v = tuple(cmbntns[c])
if rasterBandUniqueVal[v] > 0:
area = str(rasterBandUniqueVal[v] * cRPX * cRPY)
cList = str(c) + '\t' + ','.join([str(l) for l in cmbntns[c]]) + '\t' + str(rasterBandUniqueVal[v]).rstrip('.0') + '\t' + area + str('\n')
cList = str(c) + '\t' + ','.join([str(l) for l in cmbntns[c]]) + '\t' + cfg.reSCP.sub(r'\.0$', '', str(rasterBandUniqueVal[v])) + '\t' + area + str('\n')
l.write(cList)
except Exception as err:
pass
Expand Down
16 changes: 8 additions & 8 deletions maininterface/classreportTab.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ def calculateClassificationReport(self, classificationPath, NoDataValue = None,
else:
r = rasterOutput
if r is not False:
if r.lower().endswith(".csv"):
if r.lower().endswith('.csv'):
pass
else:
r = r + ".csv"
r = r + '.csv'
cfg.reportPth = cfg.utls.createTempRasterPath('csv')
try:
clssRstrSrc = str(classificationPath)
Expand Down Expand Up @@ -135,9 +135,9 @@ def calculateClassificationReport(self, classificationPath, NoDataValue = None,
else:
p = (float(rasterBandUniqueVal[i]) /float(sumTot)) * 100
if 'degree' not in un:
t = str(i).rstrip('.0') + ' ' + str(rasterBandUniqueVal[i]).rstrip('.0') + ' ' + str(p) + ' ' + str(rasterBandUniqueVal[i] * cRPX * cRPY) + str('\n')
t = cfg.reSCP.sub(r'\.0$', '', str(i)) + ' ' + cfg.reSCP.sub(r'\.0$', '', str(rasterBandUniqueVal[i])) + ' ' + str(p) + ' ' + cfg.reSCP.sub(r'\.0$', '', str(rasterBandUniqueVal[i] * cRPX * cRPY)) + str('\n')
else:
t = str(i).rstrip('.0') + ' ' + str(rasterBandUniqueVal[i]).rstrip('.0') + ' ' + str(p) + str('\n')
t = cfg.reSCP.sub(r'\.0$', '', str(i)) + ' ' + cfg.reSCP.sub(r'\.0$', '', str(rasterBandUniqueVal[i])) + ' ' + str(p) + str('\n')
l.write(t)
l.close()
cfg.uiUtls.updateBar(80)
Expand All @@ -149,17 +149,17 @@ def calculateClassificationReport(self, classificationPath, NoDataValue = None,
cfg.ui.report_textBrowser.setText(str(reportTxt))
except Exception as err:
# logger
cfg.utls.logCondition(str(__name__) + '-' + str(cfg.inspectSCP.stack()[0][3])+ ' ' + cfg.utls.lineOfCode(), " ERROR exception: " + str(err))
cfg.utls.logCondition(str(__name__) + '-' + str(cfg.inspectSCP.stack()[0][3])+ ' ' + cfg.utls.lineOfCode(), ' ERROR exception: ' + str(err))
if batch == 'No':
cfg.uiUtls.removeProgressBar()
cfg.utls.logCondition(str(__name__) + '-' + str(cfg.inspectSCP.stack()[0][3])+ ' ' + cfg.utls.lineOfCode(), " report calculated")
cfg.utls.logCondition(str(__name__) + '-' + str(cfg.inspectSCP.stack()[0][3])+ ' ' + cfg.utls.lineOfCode(), ' report calculated')
try:
cfg.shutilSCP.copy(cfg.reportPth, r)
# logger
cfg.utls.logCondition(str(__name__) + '-' + str(cfg.inspectSCP.stack()[0][3])+ ' ' + cfg.utls.lineOfCode(), " report saved")
cfg.utls.logCondition(str(__name__) + '-' + str(cfg.inspectSCP.stack()[0][3])+ ' ' + cfg.utls.lineOfCode(), ' report saved')
except Exception as err:
# logger
cfg.utls.logCondition(str(__name__) + '-' + str(cfg.inspectSCP.stack()[0][3])+ ' ' + cfg.utls.lineOfCode(), " ERROR exception: " + str(err))
cfg.utls.logCondition(str(__name__) + '-' + str(cfg.inspectSCP.stack()[0][3])+ ' ' + cfg.utls.lineOfCode(), ' ERROR exception: ' + str(err))
if batch == 'No':
cfg.uiUtls.removeProgressBar()
cfg.utls.finishSound()
Expand Down
6 changes: 3 additions & 3 deletions maininterface/downloadproducts.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ def displayImagesNASA(self, row, progress, preview = 'No'):

# display image in label
def previewInLabel(self, imagePath):
tmpImage = imagePath.replace('.jp2', '.png')
tmpImage = cfg.reSCP.sub(r'\.jp2$', '.png', str(imagePath))
if imagePath.endswith('.jp2') and not cfg.osSCP.path.isfile(tmpImage):
cfg.utls.getGDALForMac()
# georeference thumbnail
Expand Down Expand Up @@ -1226,7 +1226,7 @@ def displayGranulesSentinel2(self, row, progress, preview = 'No'):
if preview == 'Yes' and cfg.osSCP.path.isfile(imOut):
self.previewInLabel(imOut)
return imOut
if cfg.osSCP.path.isfile(imOut + '.vrt') or cfg.osSCP.path.isfile(imOut.replace('.jp2', '.png') + '.vrt'):
if cfg.osSCP.path.isfile(imOut + '.vrt') or cfg.osSCP.path.isfile(cfg.reSCP.sub(r'\.jp2$', '.png', str(imOut)) + '.vrt' ):
l = cfg.utls.selectLayerbyName(imgID)
if l is not None:
cfg.utls.setLayerVisible(l, True)
Expand All @@ -1248,7 +1248,7 @@ def displayGranulesSentinel2(self, row, progress, preview = 'No'):
max_lon = str(tW.item(i, 9).text())
self.onflyGeorefImage(imOut, imOut + '.vrt', min_lon, max_lon, min_lat, max_lat)
if cfg.osSCP.path.isfile(imOut + '.vrt'):
r =cfg.utls.addRasterLayer(imOut + '.vrt', imgID.replace('.vrt',''))
r =cfg.utls.addRasterLayer(imOut + '.vrt', cfg.reSCP.sub(r'\.vrt$', '', str(imgID)))
# logger
cfg.utls.logCondition(str(__name__) + '-' + str(cfg.inspectSCP.stack()[0][3])+ ' ' + cfg.utls.lineOfCode(), ' granules displayed')

Expand Down
14 changes: 7 additions & 7 deletions maininterface/randomForestTab.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,15 +382,15 @@ def randomForestClassification(self, batch = 'No', outputFile = None, bandSetNum
# copy confidence raster
if cfg.rasterCompression != 'No':
try:
cfg.utls.GDALCopyRaster(iL[1], rstrOut.rstrip('.tif') + '_conf.tif', 'GTiff', cfg.rasterCompression, 'LZW')
cfg.utls.GDALCopyRaster(iL[1], cfg.reSCP.sub(r'\.tif$', '', str(rstrOut)) + '_conf.tif', 'GTiff', cfg.rasterCompression, 'LZW')
except Exception as err:
# logger
cfg.utls.logCondition(str(__name__) + '-' + str(cfg.inspectSCP.stack()[0][3])+ ' ' + cfg.utls.lineOfCode(), ' ERROR exception: ' + str(err))
else:
cfg.shutilSCP.copy(iL[1], rstrOut.rstrip('.tif') + '_conf.tif')
cfg.shutilSCP.copy(iL[1], cfg.reSCP.sub(r'\.tif$', '', str(rstrOut)) + '_conf.tif')
if evalClassifier == 'true':
try:
cfg.shutilSCP.copy(outTxt, rstrOut.rstrip('.tif') + '_val.txt')
cfg.shutilSCP.copy(outTxt, cfg.reSCP.sub(r'\.tif$', '', str(rstrOut)) + '_val.txt')
except Exception as err:
# logger
cfg.utls.logCondition(str(__name__) + '-' + str(cfg.inspectSCP.stack()[0][3])+ ' ' + cfg.utls.lineOfCode(), ' ERROR exception: ' + str(err))
Expand All @@ -413,18 +413,18 @@ def randomForestClassification(self, batch = 'No', outputFile = None, bandSetNum
pass
if cfg.actionCheck == 'Yes':
# load raster bands
v = cfg.utls.addRasterLayer(rstrOut.rstrip('.tif') + '_conf.tif')
v = cfg.utls.addRasterLayer(cfg.reSCP.sub(r'\.tif$', '', str(rstrOut)) + '_conf.tif')
r = cfg.utls.addRasterLayer(rstrOut)
# apply symbology
#cfg.utls.rasterSymbolSingleBandGray(v)
sL = cfg.classTab.getSignatureList(bandSetNumber)
cfg.classTab.applyClassSymbology(r, macroclass, cfg.qmlFl, sL)
# save qml file
cfg.utls.saveQmlStyle(r, rstrOut.rstrip('.tif') + '.qml')
cfg.utls.saveQmlStyle(r, cfg.reSCP.sub(r'\.tif$', '', str(rstrOut)) + '.qml')
if saveClassifier == 'Yes':
try:
cfg.shutilSCP.copy(outTxt.rstrip('.txt') + '.class', rstrOut.rstrip('.tif') + '.class')
cfg.shutilSCP.copy(outTxt.rstrip('.txt') + '.xml', rstrOut.rstrip('.tif') + '.xml')
cfg.shutilSCP.copy(cfg.reSCP.sub(r'\.txt$', '', str(outTxt)) + '.class', cfg.reSCP.sub(r'\.tif$', '', str(rstrOut)) + '.class')
cfg.shutilSCP.copy(cfg.reSCP.sub(r'\.txt$', '', str(outTxt)) + '.xml', cfg.reSCP.sub(r'\.tif$', '', str(rstrOut)) + '.xml')
except Exception as err:
# logger
cfg.utls.logCondition(str(__name__) + '-' + str(cfg.inspectSCP.stack()[0][3])+ ' ' + cfg.utls.lineOfCode(), ' ERROR exception: ' + str(err))
Expand Down
6 changes: 5 additions & 1 deletion metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name=Semi-Automatic Classification Plugin
qgisMinimumVersion=3.00
description=The Semi-Automatic Classification Plugin (SCP) allows for the supervised classification of remote sensing images, providing tools for the download, the preprocessing and postprocessing of images.
version=7.9.3
version=7.9.4
about=Developed by Luca Congedo, the Semi-Automatic Classification Plugin (SCP) allows for the supervised classification of remote sensing images, providing tools for the download, the preprocessing and postprocessing of images. Search and download is available for ASTER, GOES, Landsat, MODIS, Sentinel-1, Sentinel-2, and Sentinel-3 images. Several algorithms are available for the land cover classification. This plugin requires the installation of GDAL, OGR, Numpy, SciPy, and Matplotlib. Some tools require also the installation of SNAP (ESA Sentinel Application Platform). For more information please visit https://fromgistors.blogspot.com .

author=Luca Congedo
Expand All @@ -14,6 +14,10 @@ icon=semiautomaticclassificationplugin.png
; start of optional metadata
changelog=

7.9.4
-fixed accuracy overall metrics
-various bugfixing

7.9.3
-fixed clip multiple rasters

Expand Down
Loading

0 comments on commit f50da4c

Please sign in to comment.