mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Add i.landsat.acc algorithm
This commit is contained in:
parent
90758b533c
commit
8ff07cf91a
@ -0,0 +1,14 @@
|
|||||||
|
i.landsat.acca
|
||||||
|
Performs Landsat TM/ETM+ Automatic Cloud Cover Assessment (ACCA).
|
||||||
|
Imagery (i.*)
|
||||||
|
ParameterMultipleInput|rasters|Landsat input rasters|3|False
|
||||||
|
ParameterNumber|b56composite|B56composite (step 6)|0|None|225|True
|
||||||
|
ParameterNumber|b45ratio|B45ratio: Desert detection (step 10)|0|None|1|True
|
||||||
|
ParameterNumber|histogram|Number of classes in the cloud temperature histogram|0|None|100|True
|
||||||
|
*ParameterBoolean|-5|Data is Landsat-5 TM|False
|
||||||
|
*ParameterBoolean|-f|Apply post-processing filter to remove small holes|False
|
||||||
|
*ParameterBoolean|-x|Always use cloud signature (step 14)|False
|
||||||
|
*ParameterBoolean|-2|Bypass second-pass processing, and merge warm (not ambiguous) and cold clouds|False
|
||||||
|
*ParameterBoolean|-s|Include a category for cloud shadows|False
|
||||||
|
OutputRaster|output|ACCA Raster
|
||||||
|
|
@ -51,7 +51,7 @@ def multipleOutputDir(alg, field, basename=None):
|
|||||||
alg.outputCommands.extend(commands)
|
alg.outputCommands.extend(commands)
|
||||||
|
|
||||||
|
|
||||||
def orderedInput(alg, inputParameter, targetParameterDef):
|
def orderedInput(alg, inputParameter, targetParameterDef, numSeq=None):
|
||||||
"""Inport multiple rasters in the order"""
|
"""Inport multiple rasters in the order"""
|
||||||
rasters = alg.getParameterValue(inputParameter).split(';')
|
rasters = alg.getParameterValue(inputParameter).split(';')
|
||||||
# TODO: make targetParameter
|
# TODO: make targetParameter
|
||||||
@ -59,12 +59,16 @@ def orderedInput(alg, inputParameter, targetParameterDef):
|
|||||||
rootFilename = '{}_'.format(alg.getTempFilename())
|
rootFilename = '{}_'.format(alg.getTempFilename())
|
||||||
inputParameter.value = rootFilename
|
inputParameter.value = rootFilename
|
||||||
alg.addParameter(inputParameter)
|
alg.addParameter(inputParameter)
|
||||||
|
# Handle specific range
|
||||||
|
if numSeq is None:
|
||||||
|
numSeq = range(1, len(rasters) + 1)
|
||||||
|
|
||||||
for idx in range(len(rasters)):
|
for idx in range(len(rasters)):
|
||||||
layer = rasters[idx]
|
layer = rasters[idx]
|
||||||
if layer in alg.exportedLayers.keys():
|
if layer in alg.exportedLayers.keys():
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
destFilename = '{}{}'.format(rootFilename, idx + 1)
|
destFilename = '{}{}'.format(rootFilename, numSeq[idx])
|
||||||
alg.setSessionProjectionFromLayer(layer, alg.commands)
|
alg.setSessionProjectionFromLayer(layer, alg.commands)
|
||||||
alg.exportedLayers[layer] = destFilename
|
alg.exportedLayers[layer] = destFilename
|
||||||
command = 'r.external input={} band=1 output={} --overwrite -o'.format(layer, destFilename)
|
command = 'r.external input={} band=1 output={} --overwrite -o'.format(layer, destFilename)
|
||||||
|
49
python/plugins/processing/algs/grass7/ext/i_landsat_acca.py
Normal file
49
python/plugins/processing/algs/grass7/ext/i_landsat_acca.py
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
"""
|
||||||
|
***************************************************************************
|
||||||
|
i_landsat_acca.py
|
||||||
|
-----------------
|
||||||
|
Date : March 2016
|
||||||
|
Copyright : (C) 2016 by Médéric Ribreux
|
||||||
|
Email : medspx at medspx dot fr
|
||||||
|
***************************************************************************
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or modify *
|
||||||
|
* it under the terms of the GNU General Public License as published by *
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or *
|
||||||
|
* (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
***************************************************************************
|
||||||
|
"""
|
||||||
|
|
||||||
|
__author__ = 'Médéric Ribreux'
|
||||||
|
__date__ = 'March 2016'
|
||||||
|
__copyright__ = '(C) 2016, Médéric Ribreux'
|
||||||
|
|
||||||
|
# This will get replaced with a git SHA1 when you do a git archive
|
||||||
|
|
||||||
|
__revision__ = '$Format:%H$'
|
||||||
|
|
||||||
|
from i import verifyRasterNum, orderedInput
|
||||||
|
|
||||||
|
|
||||||
|
def checkParameterValuesBeforeExecuting(alg):
|
||||||
|
return verifyRasterNum(alg, 'rasters', 5, 5)
|
||||||
|
|
||||||
|
|
||||||
|
def processInputs(alg):
|
||||||
|
orderedInput(alg, 'rasters',
|
||||||
|
"ParameterString|input|Base name of input raster bands|None|False|False",
|
||||||
|
[2, 3, 4, 5, 61])
|
||||||
|
|
||||||
|
|
||||||
|
def processCommand(alg):
|
||||||
|
# Remove rasters parameter
|
||||||
|
rasters = alg.getParameterFromName('rasters')
|
||||||
|
alg.parameters.remove(rasters)
|
||||||
|
|
||||||
|
alg.processCommand()
|
||||||
|
|
||||||
|
# re-add rasters
|
||||||
|
alg.addParameter(rasters)
|
@ -35,7 +35,8 @@ def checkParameterValuesBeforeExecuting(alg):
|
|||||||
|
|
||||||
def processInputs(alg):
|
def processInputs(alg):
|
||||||
orderedInput(alg, 'rasters',
|
orderedInput(alg, 'rasters',
|
||||||
"ParameterString|input|Base name of input raster bands|None|False|False")
|
"ParameterString|input|Base name of input raster bands|None|False|False",
|
||||||
|
[1, 2, 3, 4, 5, 61, 62, 7, 8])
|
||||||
|
|
||||||
|
|
||||||
def processCommand(alg):
|
def processCommand(alg):
|
||||||
@ -52,7 +53,6 @@ def processCommand(alg):
|
|||||||
param.value = '{}_'.format(alg.getTempFilename())
|
param.value = '{}_'.format(alg.getTempFilename())
|
||||||
alg.addParameter(param)
|
alg.addParameter(param)
|
||||||
|
|
||||||
# Regroup rasters
|
|
||||||
alg.processCommand()
|
alg.processCommand()
|
||||||
|
|
||||||
# re-add output
|
# re-add output
|
||||||
|
Loading…
x
Reference in New Issue
Block a user