Skip to content

Commit 297c632

Browse files
author
Médéric RIBREUX
committedMay 29, 2016
Add i.tasscap algorithm
1 parent 68f42a4 commit 297c632

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed
 
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
i.tasscap
2+
Performs Tasseled Cap (Kauth Thomas) transformation.
3+
Imagery (i.*)
4+
ParameterMultipleInput|input|Input rasters. Landsat4-7: bands 1,2,3,4,5,7; Landsat8: bands 2,3,4,5,6,7; MODIS: bands 1,2,3,4,5,6,7|3|False
5+
ParameterSelection|sensor|Satellite sensor|landsat4_tm;landsat5_tm;landsat7_etm;landsat8_oli;modis|0
6+
OutputDirectory|output|Output Directory
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
***************************************************************************
5+
i_tasscap.py
6+
------------
7+
Date : March 2016
8+
Copyright : (C) 2016 by Médéric Ribreux
9+
Email : medspx at medspx dot fr
10+
***************************************************************************
11+
* *
12+
* This program is free software; you can redistribute it and/or modify *
13+
* it under the terms of the GNU General Public License as published by *
14+
* the Free Software Foundation; either version 2 of the License, or *
15+
* (at your option) any later version. *
16+
* *
17+
***************************************************************************
18+
"""
19+
20+
__author__ = 'Médéric Ribreux'
21+
__date__ = 'March 2016'
22+
__copyright__ = '(C) 2016, Médéric Ribreux'
23+
24+
# This will get replaced with a git SHA1 when you do a git archive
25+
26+
__revision__ = '$Format:%H$'
27+
28+
from i import multipleOutputDir, verifyRasterNum, regroupRasters
29+
from processing.core.parameters import getParameterFromString
30+
31+
32+
def checkParameterValuesBeforeExecuting(alg):
33+
return verifyRasterNum(alg, 'input', 6, 8)
34+
35+
36+
def processCommand(alg):
37+
# Remove output
38+
output = alg.getOutputFromName('output')
39+
alg.removeOutputFromName('output')
40+
41+
# Create output parameter
42+
param = getParameterFromString("ParameterString|output|output basename|None|False|False")
43+
param.value = alg.getTempFilename()
44+
alg.addParameter(param)
45+
46+
alg.processCommand()
47+
48+
# re-add output
49+
alg.addOutput(output)
50+
51+
52+
def processOutputs(alg):
53+
param = alg.getParameterFromName('output')
54+
multipleOutputDir(alg, 'output', param.value)
55+
56+
# Delete output parameter
57+
alg.parameters.remove(param)

0 commit comments

Comments
 (0)
Please sign in to comment.