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

WIP: updating QGIS script

parent fb727361
......@@ -85,11 +85,13 @@ class GetStratificationMap(QgsProcessingAlgorithm):
def processAlgorithm(self, parameters, context, feedback):
metric = self.parameterAsString(
metric_ly = self.parameterAsRasterLayer(
parameters,
self.INPUT,
context
)
metric = metric_ly.dataProvider().dataSourceUri()
output_vector = self.parameterAsOutputLayer(
parameters,
......
......@@ -241,8 +241,8 @@ class LandscapeStratificationMetric(QgsProcessingAlgorithm):
to_del.append(mask)
# Compute metric using no-data value
LS_Strat_pre = os.path.join(tmp_folder, prefix+"LandStrat_metric_pre.tif")
LS_app_parameters = {"ndvits": Moy_TS, "out": LS_Strat_pre, "outputpixeltype": 5}
LS_Strat_norm = os.path.join(tmp_folder, prefix+"LandStrat_metric_pre.tif")
LS_app_parameters = {"ndvits": Moy_TS, "out": LS_Strat_norm, "rescale": "minmax", "rescale.minmax.outmin": 0, "rescale.minmax.outmax": 2048, "outputpixeltype": 2}
if ndv is not None:
LS_app_parameters["bv"] = ndv
if cbegin != None :
......@@ -250,20 +250,25 @@ class LandscapeStratificationMetric(QgsProcessingAlgorithm):
if cend != None :
LS_app_parameters["cend"]=cend
processing.run("otb:LandscapeStratificationMetric", LS_app_parameters, context=context, feedback=feedback)
to_del.append(LS_Strat_pre)
to_del.append(LS_Strat_norm)
'''
LS_Strat_raw = os.path.join(tmp_folder, prefix + "LandStrat_metric_raw.tif")
ND_app_parameters = {'in': LS_Strat_pre, 'out': LS_Strat_raw, 'mode': 'apply', 'mode.apply.mask': mask,
'outputpixeltype': 5}
processing.run('otb:ManageNoData', ND_app_parameters, context=context, feedback=feedback)
setNoDataValue(LS_Strat_raw, ndv)
to_del.append(LS_Strat_raw)
'''
'''
LS_Strat_norm = os.path.join(tmp_folder, prefix+"LandStrat_metric_norm.tif")
DC_app_parameters={"in":LS_Strat_raw, "out":LS_Strat_norm, "mask":mask, "outmin":1, "outmax":2048, "quantile.low":0, "quantile.high":0, "outputpixeltype":2}
#DC_app_parameters={"in":LS_Strat_pre, "out":LS_Strat_norm, "mask":mask, "outmin":1, "outmax":2048, "quantile.low":0, "quantile.high":0, "outputpixeltype":2}
DC_app_parameters={"in":LS_Strat_pre, "out":LS_Strat_norm, "outmin":1, "outmax":2048, "quantile.low":0, "quantile.high":0, "outputpixeltype":2}
processing.run("otb:DynamicConvert", DC_app_parameters, context=context, feedback=feedback)
to_del.append(LS_Strat_norm)
'''
LS_Strat = output_raster
ND_app_parameters = {'in': LS_Strat_norm, 'out':LS_Strat, 'mode':'apply', 'mode.apply.mask':mask, 'outputpixeltype':2}
out_layer = processing.run('otb:ManageNoData', ND_app_parameters, context=context, feedback=feedback)
......
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