Skip to content

Commit ecf6d2a

Browse files
author
Médéric RIBREUX
committedMay 29, 2016
Add i.landsat.toar algorithm
1 parent aabcc1e commit ecf6d2a

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed
 
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
i.landsat.toar
2+
Calculates top-of-atmosphere radiance or reflectance and temperature for Landsat MSS/TM/ETM+/OLI
3+
Imagery (i.*)
4+
ParameterMultipleInput|rasters|Landsat input rasters|3|False
5+
ParameterFile|metfile|Name of Landsat metadata file (.met or MTL.txt)|False|True
6+
ParameterSelection|sensor|Spacecraft sensor|mss1;mss2;mss3;mss4;mss5;tm4;tm5;tm7;oli8|7
7+
ParameterSelection|method|Atmospheric correction method|uncorrected;dos1;dos2;dos2b;dos3;dos4|0
8+
ParameterString|date|Image acquisition date (yyyy-mm-dd)|None|False|True
9+
ParameterString|sun_elevation|Sun elevation in degrees|None|False|True
10+
ParameterString|product_date|Image creation date (yyyy-mm-dd)|None|False|True
11+
ParameterString|gain|Gain (H/L) of all Landsat ETM+ bands (1-5,61,62,7,8)|None|False|True
12+
ParameterNumber|percent|Percent of solar radiance in path radiance|0.0|100.0|0.01|True
13+
ParameterNumber|pixel|Minimum pixels to consider digital number as dark object|0|None|1000|True
14+
ParameterNumber|rayleigh|Rayleigh atmosphere (diffuse sky irradiance)|0.0|None|0.0|True
15+
ParameterNumber|scale|Scale factor for output|1.0|None|1.0|True
16+
*ParameterBoolean|-r|Output at-sensor radiance instead of reflectance for all bands|False
17+
*ParameterBoolean|-n|Input raster maps use as extension the number of the band instead the code|False
18+
OutputDirectory|output|Output Directory
19+
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
***************************************************************************
5+
i_landsat_toar.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, orderedInput
29+
from processing.core.parameters import getParameterFromString
30+
31+
32+
def checkParameterValuesBeforeExecuting(alg):
33+
return verifyRasterNum(alg, 'rasters', 5, 12)
34+
35+
36+
def processInputs(alg):
37+
orderedInput(alg, 'rasters',
38+
"ParameterString|input|Base name of input raster bands|None|False|False")
39+
40+
41+
def processCommand(alg):
42+
# Remove rasters parameter
43+
rasters = alg.getParameterFromName('rasters')
44+
alg.parameters.remove(rasters)
45+
46+
# Remove output
47+
output = alg.getOutputFromName('output')
48+
alg.removeOutputFromName('output')
49+
50+
# Create output parameter
51+
param = getParameterFromString("ParameterString|output|output basename|None|False|False")
52+
param.value = '{}_'.format(alg.getTempFilename())
53+
alg.addParameter(param)
54+
55+
# Regroup rasters
56+
alg.processCommand()
57+
58+
# re-add output
59+
alg.addOutput(output)
60+
alg.addParameter(rasters)
61+
62+
63+
def processOutputs(alg):
64+
param = alg.getParameterFromName('output')
65+
multipleOutputDir(alg, 'output', param.value)
66+
67+
# Delete output parameter
68+
alg.parameters.remove(param)

0 commit comments

Comments
 (0)
Please sign in to comment.