Commit a7c3e62b authored by Gaetano Raffaele's avatar Gaetano Raffaele
Browse files

WIP: complete refactoring of stratification application.

parent d76721b4
......@@ -13,12 +13,11 @@
from qgis.PyQt.QtCore import QCoreApplication
from qgis.core import (QgsProcessingAlgorithm,
QgsProcessingParameterFolderDestination,
QgsProcessingParameterFile,
QgsProcessingParameterString,
QgsProcessingParameterNumber,
QgsProcessingParameterRasterDestination,
QgsProcessingContext)
QgsProcessingParameterRasterLayer,
QgsProcessingParameterRasterDestination)
from qgis import processing
import os
import gdal
......@@ -146,7 +145,7 @@ class LandscapeStratification(QgsProcessingAlgorithm):
def initAlgorithm(self, config=None):
self.addParameter(
QgsProcessingParameterFile(
QgsProcessingParameterRasterLayer(
self.INPUT,
self.tr('Input NDVI stack')
)
......@@ -226,7 +225,11 @@ class LandscapeStratification(QgsProcessingAlgorithm):
def processAlgorithm(self, parameters, context, feedback):
Smooth_TS = parameters['INPUT']
Smooth_TS = self.parameterAsString(
parameters,
self.INPUT,
context
)
datefile = self.parameterAsString(
parameters,
......@@ -234,7 +237,12 @@ class LandscapeStratification(QgsProcessingAlgorithm):
context
)
output_raster = parameters['OUTPUT'].sink.staticValue()
output_raster = self.parameterAsOutputLayer(
parameters,
self.OUTPUT,
context
)
output_folder = os.path.dirname(output_raster)
prefix = os.path.splitext(os.path.basename(output_raster))[0] + '_'
......@@ -296,13 +304,7 @@ class LandscapeStratification(QgsProcessingAlgorithm):
LS_Strat = output_raster
ND_app_parameters = {'in': LS_Strat_norm, 'out':LS_Strat, 'mode':'apply', 'mode.apply.mask':mask, 'outputpixeltype':2}
processing.run('otb:ManageNoData', ND_app_parameters, context=context, feedback=feedback)
out_layer = processing.run('otb:ManageNoData', ND_app_parameters, context=context, feedback=feedback)
setNoDataValue(LS_Strat, ndv)
'''
nm = os.path.basename(os.path.splitext(LS_Strat)[0])
context.addLayerToLoadOnCompletion(LS_Strat,
QgsProcessingContext.LayerDetails(name=nm, project=context.project()))
'''
return {'OUT':LS_Strat}
return {self.OUTPUT: out_layer}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment