Commit 9566730b authored by Gaetano Raffaele's avatar Gaetano Raffaele
Browse files

WIP: complete refactoring of stratification application.

parent 67c4afed
No related merge requests found
Showing with 5 additions and 13 deletions
+5 -13
......@@ -203,14 +203,6 @@ class LandscapeStratification(QgsProcessingAlgorithm):
)
)
self.addParameter(
QgsProcessingParameterString(
self.PREFIX,
self.tr('Output files prefix'),
''
)
)
self.addParameter(
QgsProcessingParameterNumber(
self.CBEGIN,
......@@ -254,9 +246,7 @@ class LandscapeStratification(QgsProcessingAlgorithm):
output_folder = os.path.dirname(output_raster)
prefix = parameters['PREFIX'] if parameters['PREFIX'] != None else ''
if len(prefix)>0 and prefix[-1] != '_':
prefix+='_'
prefix = os.path.splitext(os.path.basename(output_raster))[0] + '_'
begin_date = parameters['BEGDATE'] if parameters['BEGDATE'] != None else 20000101
end_date = parameters['ENDDATE'] if parameters['ENDDATE'] != None else int(datetime.date.today().strftime("%Y%m%d"))
......@@ -318,8 +308,10 @@ class LandscapeStratification(QgsProcessingAlgorithm):
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}
......@@ -40,7 +40,7 @@ def get_period_intervals(date_file, md=[1, 1], duration=365):
return periods
def get_mean_expression(periods):
l = periods[0][1] - periods[0][0] + 1
l = periods[0][1] - periods[0][0]
expr = []
for i in range(1, l + 1):
s = [p[0] + i for p in periods]
......
Supports Markdown
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