Skip to content
Permalink
Browse files

Add i.landsat.toar algorithm

  • Loading branch information
Médéric RIBREUX
Médéric RIBREUX committed Apr 28, 2016
1 parent aabcc1e commit ecf6d2ad37a04efcfe576da297ed48138e2ea90b
@@ -0,0 +1,19 @@
i.landsat.toar
Calculates top-of-atmosphere radiance or reflectance and temperature for Landsat MSS/TM/ETM+/OLI
Imagery (i.*)
ParameterMultipleInput|rasters|Landsat input rasters|3|False
ParameterFile|metfile|Name of Landsat metadata file (.met or MTL.txt)|False|True
ParameterSelection|sensor|Spacecraft sensor|mss1;mss2;mss3;mss4;mss5;tm4;tm5;tm7;oli8|7
ParameterSelection|method|Atmospheric correction method|uncorrected;dos1;dos2;dos2b;dos3;dos4|0
ParameterString|date|Image acquisition date (yyyy-mm-dd)|None|False|True
ParameterString|sun_elevation|Sun elevation in degrees|None|False|True
ParameterString|product_date|Image creation date (yyyy-mm-dd)|None|False|True
ParameterString|gain|Gain (H/L) of all Landsat ETM+ bands (1-5,61,62,7,8)|None|False|True
ParameterNumber|percent|Percent of solar radiance in path radiance|0.0|100.0|0.01|True
ParameterNumber|pixel|Minimum pixels to consider digital number as dark object|0|None|1000|True
ParameterNumber|rayleigh|Rayleigh atmosphere (diffuse sky irradiance)|0.0|None|0.0|True
ParameterNumber|scale|Scale factor for output|1.0|None|1.0|True
*ParameterBoolean|-r|Output at-sensor radiance instead of reflectance for all bands|False
*ParameterBoolean|-n|Input raster maps use as extension the number of the band instead the code|False
OutputDirectory|output|Output Directory

@@ -0,0 +1,68 @@
# -*- coding: utf-8 -*-

"""
***************************************************************************
i_landsat_toar.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 multipleOutputDir, verifyRasterNum, regroupRasters, orderedInput
from processing.core.parameters import getParameterFromString


def checkParameterValuesBeforeExecuting(alg):
return verifyRasterNum(alg, 'rasters', 5, 12)


def processInputs(alg):
orderedInput(alg, 'rasters',
"ParameterString|input|Base name of input raster bands|None|False|False")


def processCommand(alg):
# Remove rasters parameter
rasters = alg.getParameterFromName('rasters')
alg.parameters.remove(rasters)

# Remove output
output = alg.getOutputFromName('output')
alg.removeOutputFromName('output')

# Create output parameter
param = getParameterFromString("ParameterString|output|output basename|None|False|False")
param.value = '{}_'.format(alg.getTempFilename())
alg.addParameter(param)

# Regroup rasters
alg.processCommand()

# re-add output
alg.addOutput(output)
alg.addParameter(rasters)


def processOutputs(alg):
param = alg.getParameterFromName('output')
multipleOutputDir(alg, 'output', param.value)

# Delete output parameter
alg.parameters.remove(param)

0 comments on commit ecf6d2a

Please sign in to comment.
You can’t perform that action at this time.