diff --git a/python/plugins/processing/algs/grass7/description/r.li.cwed.ascii.txt b/python/plugins/processing/algs/grass7/description/r.li.cwed.ascii.txt new file mode 100644 index 00000000000..2235f466455 --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.cwed.ascii.txt @@ -0,0 +1,8 @@ +r.li.cwed +r.li.cwed.ascii - Calculates contrast weighted edge density index on a raster map +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +ParameterFile|path|Name of file that contains the weight to calculate the index|False +OutputFile|output|CWED diff --git a/python/plugins/processing/algs/grass7/description/r.li.cwed.txt b/python/plugins/processing/algs/grass7/description/r.li.cwed.txt new file mode 100644 index 00000000000..ac91495d8bb --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.cwed.txt @@ -0,0 +1,8 @@ +r.li.cwed +Calculates contrast weighted edge density index on a raster map +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +ParameterFile|path|Name of file that contains the weight to calculate the index|False +OutputRaster|output|CWED diff --git a/python/plugins/processing/algs/grass7/description/r.li.dominance.ascii.txt b/python/plugins/processing/algs/grass7/description/r.li.dominance.ascii.txt new file mode 100644 index 00000000000..358fdff077f --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.dominance.ascii.txt @@ -0,0 +1,7 @@ +r.li.dominance +r.li.dominance.ascii - Calculates dominance's diversity index on a raster map +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +OutputFile|output|Dominance diff --git a/python/plugins/processing/algs/grass7/description/r.li.dominance.txt b/python/plugins/processing/algs/grass7/description/r.li.dominance.txt new file mode 100644 index 00000000000..2eaf54a6edf --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.dominance.txt @@ -0,0 +1,7 @@ +r.li.dominance +Calculates dominance's diversity index on a raster map +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +OutputRaster|output|Dominance diff --git a/python/plugins/processing/algs/grass7/description/r.li.edgedensity.ascii.txt b/python/plugins/processing/algs/grass7/description/r.li.edgedensity.ascii.txt new file mode 100644 index 00000000000..61187f6b9d3 --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.edgedensity.ascii.txt @@ -0,0 +1,9 @@ +r.li.edgedensity +r.li.edgedensity.ascii - Calculates edge density index on a raster map, using a 4 neighbour algorithm +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +ParameterString|patch_type|The value of the patch type|None|False|True +ParameterBoolean|-b|Exclude border edges|False +OutputFile|output|Edge Density diff --git a/python/plugins/processing/algs/grass7/description/r.li.edgedensity.txt b/python/plugins/processing/algs/grass7/description/r.li.edgedensity.txt new file mode 100644 index 00000000000..120408ec5e2 --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.edgedensity.txt @@ -0,0 +1,9 @@ +r.li.edgedensity +Calculates edge density index on a raster map, using a 4 neighbour algorithm +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +ParameterString|patch_type|The value of the patch type|None|False|True +ParameterBoolean|-b|Exclude border edges|False +OutputRaster|output|Edge Density diff --git a/python/plugins/processing/algs/grass7/description/r.li.mpa.ascii.txt b/python/plugins/processing/algs/grass7/description/r.li.mpa.ascii.txt new file mode 100644 index 00000000000..af2827021b2 --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.mpa.ascii.txt @@ -0,0 +1,7 @@ +r.li.mpa +r.li.mpa.ascii - Calculates mean pixel attribute index on a raster map +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +OutputFile|output|Mean Pixel Attribute diff --git a/python/plugins/processing/algs/grass7/description/r.li.mpa.txt b/python/plugins/processing/algs/grass7/description/r.li.mpa.txt new file mode 100644 index 00000000000..d29b08075af --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.mpa.txt @@ -0,0 +1,7 @@ +r.li.mpa +Calculates mean pixel attribute index on a raster map +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +OutputRaster|output|Mean Pixel Attribute diff --git a/python/plugins/processing/algs/grass7/description/r.li.mps.ascii.txt b/python/plugins/processing/algs/grass7/description/r.li.mps.ascii.txt new file mode 100644 index 00000000000..7727c70f644 --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.mps.ascii.txt @@ -0,0 +1,7 @@ +r.li.mps +r.li.mps.ascii - Calculates mean patch size index on a raster map, using a 4 neighbour algorithm +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +OutputFile|output|Mean Patch Size diff --git a/python/plugins/processing/algs/grass7/description/r.li.mps.txt b/python/plugins/processing/algs/grass7/description/r.li.mps.txt new file mode 100644 index 00000000000..b542280be7d --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.mps.txt @@ -0,0 +1,7 @@ +r.li.mps +Calculates mean patch size index on a raster map, using a 4 neighbour algorithm +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +OutputRaster|output|Mean Patch Size diff --git a/python/plugins/processing/algs/grass7/description/r.li.padcv.ascii.txt b/python/plugins/processing/algs/grass7/description/r.li.padcv.ascii.txt new file mode 100644 index 00000000000..5a30e45fc29 --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.padcv.ascii.txt @@ -0,0 +1,7 @@ +r.li.padcv +r.li.padcv.ascii - Calculates coefficient of variation of patch area on a raster map +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +OutputFile|output|PADCV diff --git a/python/plugins/processing/algs/grass7/description/r.li.padcv.txt b/python/plugins/processing/algs/grass7/description/r.li.padcv.txt new file mode 100644 index 00000000000..3e77c163275 --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.padcv.txt @@ -0,0 +1,7 @@ +r.li.padcv +Calculates coefficient of variation of patch area on a raster map +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +OutputRaster|output|PADCV diff --git a/python/plugins/processing/algs/grass7/description/r.li.padrange.ascii.txt b/python/plugins/processing/algs/grass7/description/r.li.padrange.ascii.txt new file mode 100644 index 00000000000..7e91c643cc8 --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.padrange.ascii.txt @@ -0,0 +1,7 @@ +r.li.padrange +r.li.padrange.ascii - Calculates range of patch area size on a raster map +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +OutputFile|output|Pad Range diff --git a/python/plugins/processing/algs/grass7/description/r.li.padrange.txt b/python/plugins/processing/algs/grass7/description/r.li.padrange.txt new file mode 100644 index 00000000000..78fe107f012 --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.padrange.txt @@ -0,0 +1,7 @@ +r.li.padrange +Calculates range of patch area size on a raster map +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +OutputRaster|output|Pad Range diff --git a/python/plugins/processing/algs/grass7/description/r.li.padsd.ascii.txt b/python/plugins/processing/algs/grass7/description/r.li.padsd.ascii.txt new file mode 100644 index 00000000000..0939de3eb46 --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.padsd.ascii.txt @@ -0,0 +1,7 @@ +r.li.padsd +r.li.padsd.ascii - Calculates standard deviation of patch area a raster map +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +OutputFile|output|Patch Area SD diff --git a/python/plugins/processing/algs/grass7/description/r.li.padsd.txt b/python/plugins/processing/algs/grass7/description/r.li.padsd.txt new file mode 100644 index 00000000000..9f41c7c3dbb --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.padsd.txt @@ -0,0 +1,7 @@ +r.li.padsd +Calculates standard deviation of patch area a raster map +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +OutputRaster|output|Patch Area SD diff --git a/python/plugins/processing/algs/grass7/description/r.li.patchdensity.ascii.txt b/python/plugins/processing/algs/grass7/description/r.li.patchdensity.ascii.txt new file mode 100644 index 00000000000..91de771d050 --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.patchdensity.ascii.txt @@ -0,0 +1,7 @@ +r.li.patchdensity +r.li.patchdensity.ascii - Calculates patch density index on a raster map, using a 4 neighbour algorithm +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +OutputFile|output|Patch Density diff --git a/python/plugins/processing/algs/grass7/description/r.li.patchdensity.txt b/python/plugins/processing/algs/grass7/description/r.li.patchdensity.txt new file mode 100644 index 00000000000..0d0602670aa --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.patchdensity.txt @@ -0,0 +1,7 @@ +r.li.patchdensity +Calculates patch density index on a raster map, using a 4 neighbour algorithm +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +OutputRaster|output|Patch Density diff --git a/python/plugins/processing/algs/grass7/description/r.li.patchnum.ascii.txt b/python/plugins/processing/algs/grass7/description/r.li.patchnum.ascii.txt new file mode 100644 index 00000000000..ad11f4bf0fe --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.patchnum.ascii.txt @@ -0,0 +1,7 @@ +r.li.patchnum +r.li.patchnum.ascii - Calculates patch number index on a raster map, using a 4 neighbour algorithm. +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +OutputFile|output|Patch Number diff --git a/python/plugins/processing/algs/grass7/description/r.li.patchnum.txt b/python/plugins/processing/algs/grass7/description/r.li.patchnum.txt new file mode 100644 index 00000000000..91e55ecdd54 --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.patchnum.txt @@ -0,0 +1,7 @@ +r.li.patchnum +Calculates patch number index on a raster map, using a 4 neighbour algorithm. +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +OutputRaster|output|Patch Number diff --git a/python/plugins/processing/algs/grass7/description/r.li.pielou.ascii.txt b/python/plugins/processing/algs/grass7/description/r.li.pielou.ascii.txt new file mode 100644 index 00000000000..b2a2622a1eb --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.pielou.ascii.txt @@ -0,0 +1,7 @@ +r.li.pielou +r.li.pielou.ascii - Calculates Pielou's diversity index on a raster map +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +OutputFile|output|Pielou diff --git a/python/plugins/processing/algs/grass7/description/r.li.pielou.txt b/python/plugins/processing/algs/grass7/description/r.li.pielou.txt new file mode 100644 index 00000000000..16d3e76d25e --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.pielou.txt @@ -0,0 +1,7 @@ +r.li.pielou +Calculates Pielou's diversity index on a raster map +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +OutputRaster|output|Pielou diff --git a/python/plugins/processing/algs/grass7/description/r.li.renyi.ascii.txt b/python/plugins/processing/algs/grass7/description/r.li.renyi.ascii.txt new file mode 100644 index 00000000000..409f65e3f70 --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.renyi.ascii.txt @@ -0,0 +1,8 @@ +r.li.renyi +r.li.renyi.ascii - Calculates Renyi's diversity index on a raster map +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +ParameterString|alpha|Alpha value is the order of the generalized entropy|None|False|True +OutputFile|output|Renyi diff --git a/python/plugins/processing/algs/grass7/description/r.li.renyi.txt b/python/plugins/processing/algs/grass7/description/r.li.renyi.txt new file mode 100644 index 00000000000..9429d3b85bf --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.renyi.txt @@ -0,0 +1,8 @@ +r.li.renyi +Calculates Renyi's diversity index on a raster map +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +ParameterString|alpha|Alpha value is the order of the generalized entropy|None|False|True +OutputRaster|output|Renyi diff --git a/python/plugins/processing/algs/grass7/description/r.li.richness.ascii.txt b/python/plugins/processing/algs/grass7/description/r.li.richness.ascii.txt new file mode 100644 index 00000000000..5ef643996cc --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.richness.ascii.txt @@ -0,0 +1,7 @@ +r.li.richness +r.li.richness.ascii - Calculates richness index on a raster map +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +OutputFile|output|Richness diff --git a/python/plugins/processing/algs/grass7/description/r.li.richness.txt b/python/plugins/processing/algs/grass7/description/r.li.richness.txt new file mode 100644 index 00000000000..f7b2ca19c51 --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.richness.txt @@ -0,0 +1,7 @@ +r.li.richness +Calculates richness index on a raster map +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +OutputRaster|output|Richness diff --git a/python/plugins/processing/algs/grass7/description/r.li.shannon.ascii.txt b/python/plugins/processing/algs/grass7/description/r.li.shannon.ascii.txt new file mode 100644 index 00000000000..485d99cb45b --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.shannon.ascii.txt @@ -0,0 +1,7 @@ +r.li.shannon +r.li.shannon.ascii - Calculates Shannon's diversity index on a raster map +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +OutputFile|output|Shannon diff --git a/python/plugins/processing/algs/grass7/description/r.li.shannon.txt b/python/plugins/processing/algs/grass7/description/r.li.shannon.txt new file mode 100644 index 00000000000..0ad218f48fd --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.shannon.txt @@ -0,0 +1,7 @@ +r.li.shannon +Calculates Shannon's diversity index on a raster map +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +OutputRaster|output|Shannon diff --git a/python/plugins/processing/algs/grass7/description/r.li.shape.ascii.txt b/python/plugins/processing/algs/grass7/description/r.li.shape.ascii.txt new file mode 100644 index 00000000000..362e2640073 --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.shape.ascii.txt @@ -0,0 +1,7 @@ +r.li.shape +r.li.shape.ascii - Calculates shape index on a raster map +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +OutputFile|output|Shape diff --git a/python/plugins/processing/algs/grass7/description/r.li.shape.txt b/python/plugins/processing/algs/grass7/description/r.li.shape.txt new file mode 100644 index 00000000000..6ec0f7cf961 --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.shape.txt @@ -0,0 +1,7 @@ +r.li.shape +Calculates shape index on a raster map +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +OutputRaster|output|Shape diff --git a/python/plugins/processing/algs/grass7/description/r.li.simpson.ascii.txt b/python/plugins/processing/algs/grass7/description/r.li.simpson.ascii.txt new file mode 100644 index 00000000000..28eaa923f6a --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.simpson.ascii.txt @@ -0,0 +1,7 @@ +r.li.simpson +r.li.simpson.ascii - Calculates Simpson's diversity index on a raster map +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +OutputFile|output|Simpson diff --git a/python/plugins/processing/algs/grass7/description/r.li.simpson.txt b/python/plugins/processing/algs/grass7/description/r.li.simpson.txt new file mode 100644 index 00000000000..a783627e810 --- /dev/null +++ b/python/plugins/processing/algs/grass7/description/r.li.simpson.txt @@ -0,0 +1,7 @@ +r.li.simpson +Calculates Simpson's diversity index on a raster map +Raster (r.*) +ParameterRaster|input|Name of input raster map|False +ParameterString|config_txt|Landscape structure configuration|None|True|True +ParameterFile|config|Landscape structure configuration file|False|True +OutputRaster|output|Simpson diff --git a/python/plugins/processing/algs/grass7/ext/r_li.py b/python/plugins/processing/algs/grass7/ext/r_li.py new file mode 100644 index 00000000000..1de1244d14b --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li.py @@ -0,0 +1,148 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li.py + ------- + Date : February 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__ = 'February 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$' + +import shutil +from processing.tools.system import isWindows, isMac, userFolder, mkdir +from processing.core.parameters import getParameterFromString +from os import path + + +def rliPath(): + """Return r.li GRASS7 user dir""" + if isWindows(): + return path.join(path.expanduser("~").decode('mcbs'), 'GRASS7', 'r.li') + else: + return path.join(path.expanduser("~"), '.grass7', 'r.li') + + +def removeConfigFile(alg): + """ Remove the r.li user dir config file """ + configPath = alg.getParameterValue('config') + if isWindows(): + command = "DEL {}".format(path.join(rliPath(), configPath)) + else: + command = "rm {}".format(path.join(rliPath(), configPath)) + alg.commands.append(command) + + +def checkMovingWindow(alg, outputTxt=False): + """ Verify if we have the right parameters """ + configTxt = alg.getParameterValue('config_txt') + config = alg.getParameterValue('config') + if configTxt and config: + return alg.tr("You need to set either inline configuration or a configuration file !") + + # Verify that configuration is in moving window + movingWindow = False + if configTxt: + if 'MOVINGWINDOW' in configTxt: + movingWindow = True + + # Read config file: + if config: + with open(config) as f: + for line in f: + if 'MOVINGWINDOW' in line: + movingWindow = True + + if not movingWindow and not outputTxt: + return alg.tr('Your configuration needs to be a "moving window" configuration !') + + if movingWindow and outputTxt: + return alg.tr('Your configuration needs to be a non "moving window" configuration !') + + return None + + +def configFile(alg, outputTxt=False): + """ Handle inline configuration """ + # Where is the GRASS7 user directory ? + userGrass7Path = rliPath() + if not path.isdir(userGrass7Path): + mkdir(userGrass7Path) + if not path.isdir(path.join(userGrass7Path, 'output')): + mkdir(path.join(userGrass7Path, 'output')) + origConfigFile = alg.getParameterValue('config') + + # Handle inline configuration + configTxt = alg.getParameterFromName('config_txt') + if configTxt.value: + # Creates a temporary txt file in user r.li directory + tempConfig = alg.getTempFilename() + configFilePath = path.join(userGrass7Path, tempConfig) + # Inject rules into temporary txt file + with open(configFilePath, "w") as f: + f.write(configTxt.value) + + # Use temporary file as rules file + alg.setParameterValue('config', path.basename(configFilePath)) + alg.parameters.remove(configTxt) + + # If we have a configuration file, we need to copy it into user dir + if origConfigFile: + configFilePath = path.join(userGrass7Path, path.basename(origConfigFile)) + # Copy the file + shutil.copy(origConfigFile, configFilePath) + + # Change the parameter value + alg.setParameterValue('config', path.basename(configFilePath)) + + origOutput = alg.getOutputFromName('output') + if outputTxt: + param = getParameterFromString("ParameterString|output|txt output|None|False|True") + param.value = path.basename(origOutput.value) + alg.addParameter(param) + alg.removeOutputFromName('output') + + alg.processCommand() + + # Remove Config file: + removeConfigFile(alg) + + # re-add configTxt + alg.addParameter(configTxt) + alg.setParameterValue('config', origConfigFile) + if outputTxt: + for param in [f for f in alg.parameters if f.name == 'output']: + alg.parameters.remove(param) + alg.addOutput(origOutput) + + +def moveOutputTxtFile(alg): + # Find output file name: + origOutput = alg.getOutputValue('output') + userGrass7Path = rliPath() + + outputDir = path.join(userGrass7Path, 'output') + output = path.join(outputDir, path.basename(origOutput)) + + # move the file + if isWindows(): + command = "cp {} {}".format(output, origOutput) + else: + command = "mv {} {}".format(output, origOutput) + alg.commands.append(command) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_cwed.py b/python/plugins/processing/algs/grass7/ext/r_li_cwed.py new file mode 100644 index 00000000000..a0219530f26 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_cwed.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_cwed.py + ------------ + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile + + +def checkParameterValuesBeforeExecuting(alg): + checkMovingWindow(alg) + + +def processCommand(alg): + configFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_cwed_ascii.py b/python/plugins/processing/algs/grass7/ext/r_li_cwed_ascii.py new file mode 100644 index 00000000000..e945568ff9c --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_cwed_ascii.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_cwed_ascii.py + ------------------ + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile, moveOutputTxtFile + + +def checkParameterValuesBeforeExecuting(alg): + return checkMovingWindow(alg, True) + + +def processCommand(alg): + configFile(alg, True) + + +def processOutputs(alg): + moveOutputTxtFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_dominance.py b/python/plugins/processing/algs/grass7/ext/r_li_dominance.py new file mode 100644 index 00000000000..37ac5949035 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_dominance.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_dominance.py + ----------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile + + +def checkParameterValuesBeforeExecuting(alg): + return checkMovingWindow(alg) + + +def processCommand(alg): + configFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_dominance_ascii.py b/python/plugins/processing/algs/grass7/ext/r_li_dominance_ascii.py new file mode 100644 index 00000000000..49d7a19c2c4 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_dominance_ascii.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_dominance_ascii.py + ----------------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile, moveOutputTxtFile + + +def checkParameterValuesBeforeExecuting(alg): + return checkMovingWindow(alg, True) + + +def processCommand(alg): + configFile(alg, True) + + +def processOutputs(alg): + moveOutputTxtFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_edgedensity.py b/python/plugins/processing/algs/grass7/ext/r_li_edgedensity.py new file mode 100644 index 00000000000..b6d9eb71dae --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_edgedensity.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_edgedensity.py + ------------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile + + +def checkParameterValuesBeforeExecuting(alg): + checkMovingWindow(alg) + + +def processCommand(alg): + configFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_edgedensity_ascii.py b/python/plugins/processing/algs/grass7/ext/r_li_edgedensity_ascii.py new file mode 100644 index 00000000000..6bc262d3221 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_edgedensity_ascii.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_edgedensity_ascii.py + ------------------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile, moveOutputTxtFile + + +def checkParameterValuesBeforeExecuting(alg): + return checkMovingWindow(alg, True) + + +def processCommand(alg): + configFile(alg, True) + + +def processOutputs(alg): + moveOutputTxtFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_mpa.py b/python/plugins/processing/algs/grass7/ext/r_li_mpa.py new file mode 100644 index 00000000000..4c617b78db9 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_mpa.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_mpa.py + ----------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile + + +def checkParameterValuesBeforeExecuting(alg): + checkMovingWindow(alg) + + +def processCommand(alg): + configFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_mpa_ascii.py b/python/plugins/processing/algs/grass7/ext/r_li_mpa_ascii.py new file mode 100644 index 00000000000..fb01a9ae32f --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_mpa_ascii.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_mpa_ascii.py + ----------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile, moveOutputTxtFile + + +def checkParameterValuesBeforeExecuting(alg): + return checkMovingWindow(alg, True) + + +def processCommand(alg): + configFile(alg, True) + + +def processOutputs(alg): + moveOutputTxtFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_mps.py b/python/plugins/processing/algs/grass7/ext/r_li_mps.py new file mode 100644 index 00000000000..4a8e2881784 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_mps.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_mps.py + ----------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile + + +def checkParameterValuesBeforeExecuting(alg): + checkMovingWindow(alg) + + +def processCommand(alg): + configFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_mps_ascii.py b/python/plugins/processing/algs/grass7/ext/r_li_mps_ascii.py new file mode 100644 index 00000000000..0aefe9d2671 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_mps_ascii.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_mps_ascii.py + ----------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile, moveOutputTxtFile + + +def checkParameterValuesBeforeExecuting(alg): + return checkMovingWindow(alg, True) + + +def processCommand(alg): + configFile(alg, True) + + +def processOutputs(alg): + moveOutputTxtFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_orig.py b/python/plugins/processing/algs/grass7/ext/r_li_orig.py new file mode 100644 index 00000000000..f42252724b9 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_orig.py @@ -0,0 +1,133 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li.py + ------- + Date : February 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__ = 'February 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$' + +import shutil +from processing.tools.system import isWindows, isMac, userFolder, mkdir +from os import path + + +def rliPath(): + """Return r.li GRASS7 user dir""" + if isWindows(): + return path.join(userFolder(), 'GRASS7', 'r.li') + else: + return path.join(userFolder(), '.grass7', 'r.li') + + +def removeConfigFile(alg): + """ Remove the r.li user dir config file """ + configPath = alg.getParameterValue('config') + if isWindow(): + command = "DEL {}".format(configPath) + else: + command = "rm {}".format(configPath) + alg.commands.append(command) + + +def checkMovingWindow(alg): + """ Verify if we have the right parameters """ + configTxt = alg.getParameterValue('config_txt') + config = alg.getParameterValue('config') + if configTxt and config: + return alg.tr("You need to set either inline configuration or a configuration file !") + + # Verify that configuration is in moving window + movingWindow = False + if configTxt and 'MOVINGWINDOW' in configTxt: + movingWindow = True + + # Read config file: + if config: + with open(config) as f: + for line in f: + if 'MOVINGWINDOW' in line: + movingWindow = True + + if not movingWindow: + return alg.tr('Your configuration needs to be a "moving window" configuration !') + + return None + + +def configFile(alg, outputTxt=False): + """ Handle inline configuration """ + # Where is the GRASS7 user directory ? + userGrass7Path = rliPath() + mkdir(userGrass7Path) + origConfigFile = alg.getParameterValue('config') + + # Handle inline configuration + configTxt = alg.getParameterFromName('config_txt') + if configTxt.value: + # Creates a temporary txt file in user r.li directory + tempConfig = alg.getTempFilename() + configFilePath = path.join(userGrass7, tempConfig) + # Inject rules into temporary txt file + with open(configFilePath, "w") as f: + f.write(configTxt.value) + + # Use temporary file as rules file + alg.setParameterValue('config', configFilePath) + alg.parameters.remove(configTxt) + + # If we have a configuration file, we need to copy it into user dir + if origConfigFile: + configFilePath = path.join(userGrass7Path, path.basename(origConfigFile)) + # Copy the file + shutil.copy(origConfigFile, configFilePath) + + # Change the parameter value + alg.setParameterValue('config', configFilePath) + + if outputTxt: + origOutput = alg.getOutputValue('output') + alg.setOutputValue('output', path.basename(origOutput)) + + alg.processCommand() + + # Remove Config file: + removeConfigFile(alg) + + # re-add configTxt + alg.addParameter(configTxt) + alg.setParameterValue('config', origConfigFile) + + +def moveOutputTxtFile(alg): + # Find output file name: + origOutput = alg.getOutputValue('output') + userGrass7Path = rliPath() + + outputDir = path.join(userGrass7Path, 'OUTPUT') + output = path.join(outputDir, path.basename(origOutput)) + + # move the file + if isWindows(): + command = "cp {} {}".format(output, origOutput) + else: + command = "mv {} {}".format(output, origOutput) + alg.commands.append(command) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_padcv.py b/python/plugins/processing/algs/grass7/ext/r_li_padcv.py new file mode 100644 index 00000000000..7b4088fe1e0 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_padcv.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_padcv.py + ------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile + + +def checkParameterValuesBeforeExecuting(alg): + checkMovingWindow(alg) + + +def processCommand(alg): + configFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_padcv_ascii.py b/python/plugins/processing/algs/grass7/ext/r_li_padcv_ascii.py new file mode 100644 index 00000000000..efd2a63f1b7 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_padcv_ascii.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_padcv_ascii.py + ------------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile, moveOutputTxtFile + + +def checkParameterValuesBeforeExecuting(alg): + return checkMovingWindow(alg, True) + + +def processCommand(alg): + configFile(alg, True) + + +def processOutputs(alg): + moveOutputTxtFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_padrange.py b/python/plugins/processing/algs/grass7/ext/r_li_padrange.py new file mode 100644 index 00000000000..c0ca0cfd900 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_padrange.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_padrange.py + ---------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile + + +def checkParameterValuesBeforeExecuting(alg): + checkMovingWindow(alg) + + +def processCommand(alg): + configFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_padrange_ascii.py b/python/plugins/processing/algs/grass7/ext/r_li_padrange_ascii.py new file mode 100644 index 00000000000..340a431a911 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_padrange_ascii.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_padrange_ascii.py + ---------------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile, moveOutputTxtFile + + +def checkParameterValuesBeforeExecuting(alg): + return checkMovingWindow(alg, True) + + +def processCommand(alg): + configFile(alg, True) + + +def processOutputs(alg): + moveOutputTxtFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_padsd.py b/python/plugins/processing/algs/grass7/ext/r_li_padsd.py new file mode 100644 index 00000000000..63631ef7335 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_padsd.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_padsd.py + ------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile + + +def checkParameterValuesBeforeExecuting(alg): + checkMovingWindow(alg) + + +def processCommand(alg): + configFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_padsd_ascii.py b/python/plugins/processing/algs/grass7/ext/r_li_padsd_ascii.py new file mode 100644 index 00000000000..aa96299800c --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_padsd_ascii.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_padsd_ascii.py + ------------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile, moveOutputTxtFile + + +def checkParameterValuesBeforeExecuting(alg): + return checkMovingWindow(alg, True) + + +def processCommand(alg): + configFile(alg, True) + + +def processOutputs(alg): + moveOutputTxtFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_patchdensity.py b/python/plugins/processing/algs/grass7/ext/r_li_patchdensity.py new file mode 100644 index 00000000000..bcc1547516a --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_patchdensity.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_patchdensity.py + -------------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile + + +def checkParameterValuesBeforeExecuting(alg): + checkMovingWindow(alg) + + +def processCommand(alg): + configFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_patchdensity_ascii.py b/python/plugins/processing/algs/grass7/ext/r_li_patchdensity_ascii.py new file mode 100644 index 00000000000..0fe96593000 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_patchdensity_ascii.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_patchdensity_ascii.py + -------------------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile, moveOutputTxtFile + + +def checkParameterValuesBeforeExecuting(alg): + return checkMovingWindow(alg, True) + + +def processCommand(alg): + configFile(alg, True) + + +def processOutputs(alg): + moveOutputTxtFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_patchnum.py b/python/plugins/processing/algs/grass7/ext/r_li_patchnum.py new file mode 100644 index 00000000000..983da80e5f7 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_patchnum.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_patchnum.py + ---------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile + + +def checkParameterValuesBeforeExecuting(alg): + checkMovingWindow(alg) + + +def processCommand(alg): + configFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_patchnum_ascii.py b/python/plugins/processing/algs/grass7/ext/r_li_patchnum_ascii.py new file mode 100644 index 00000000000..9f0af4d9459 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_patchnum_ascii.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_patchnum_ascii.py + ---------------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile, moveOutputTxtFile + + +def checkParameterValuesBeforeExecuting(alg): + return checkMovingWindow(alg, True) + + +def processCommand(alg): + configFile(alg, True) + + +def processOutputs(alg): + moveOutputTxtFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_pielou.py b/python/plugins/processing/algs/grass7/ext/r_li_pielou.py new file mode 100644 index 00000000000..ecd067e5313 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_pielou.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_pielou.py + -------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile + + +def checkParameterValuesBeforeExecuting(alg): + checkMovingWindow(alg) + + +def processCommand(alg): + configFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_pielou_ascii.py b/python/plugins/processing/algs/grass7/ext/r_li_pielou_ascii.py new file mode 100644 index 00000000000..0c525acc48d --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_pielou_ascii.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_pielou_ascii.py + -------------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile, moveOutputTxtFile + + +def checkParameterValuesBeforeExecuting(alg): + return checkMovingWindow(alg, True) + + +def processCommand(alg): + configFile(alg, True) + + +def processOutputs(alg): + moveOutputTxtFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_renyi.py b/python/plugins/processing/algs/grass7/ext/r_li_renyi.py new file mode 100644 index 00000000000..843dfb8ba81 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_renyi.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_renyi.py + -------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile + + +def checkParameterValuesBeforeExecuting(alg): + checkMovingWindow(alg) + + +def processCommand(alg): + configFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_renyi_ascii.py b/python/plugins/processing/algs/grass7/ext/r_li_renyi_ascii.py new file mode 100644 index 00000000000..a8ba1953415 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_renyi_ascii.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_renyi_ascii.py + ------------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile, moveOutputTxtFile + + +def checkParameterValuesBeforeExecuting(alg): + return checkMovingWindow(alg, True) + + +def processCommand(alg): + configFile(alg, True) + + +def processOutputs(alg): + moveOutputTxtFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_richness.py b/python/plugins/processing/algs/grass7/ext/r_li_richness.py new file mode 100644 index 00000000000..097c6087ed9 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_richness.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_richness.py + ---------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile + + +def checkParameterValuesBeforeExecuting(alg): + checkMovingWindow(alg) + + +def processCommand(alg): + configFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_richness_ascii.py b/python/plugins/processing/algs/grass7/ext/r_li_richness_ascii.py new file mode 100644 index 00000000000..4105d461200 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_richness_ascii.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_richness_ascii.py + ---------------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile, moveOutputTxtFile + + +def checkParameterValuesBeforeExecuting(alg): + return checkMovingWindow(alg, True) + + +def processCommand(alg): + configFile(alg, True) + + +def processOutputs(alg): + moveOutputTxtFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_shannon.py b/python/plugins/processing/algs/grass7/ext/r_li_shannon.py new file mode 100644 index 00000000000..e95ea8df58d --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_shannon.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_shannon.py + ---------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile + + +def checkParameterValuesBeforeExecuting(alg): + checkMovingWindow(alg) + + +def processCommand(alg): + configFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_shannon_ascii.py b/python/plugins/processing/algs/grass7/ext/r_li_shannon_ascii.py new file mode 100644 index 00000000000..b83bdfa8dfb --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_shannon_ascii.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_shannon_ascii.py + --------------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile, moveOutputTxtFile + + +def checkParameterValuesBeforeExecuting(alg): + return checkMovingWindow(alg, True) + + +def processCommand(alg): + configFile(alg, True) + + +def processOutputs(alg): + moveOutputTxtFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_shape.py b/python/plugins/processing/algs/grass7/ext/r_li_shape.py new file mode 100644 index 00000000000..d94460b5e31 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_shape.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_shape.py + ------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile + + +def checkParameterValuesBeforeExecuting(alg): + checkMovingWindow(alg) + + +def processCommand(alg): + configFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_shape_ascii.py b/python/plugins/processing/algs/grass7/ext/r_li_shape_ascii.py new file mode 100644 index 00000000000..a7bcdcdf8ea --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_shape_ascii.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_shape_ascii.py + ------------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile, moveOutputTxtFile + + +def checkParameterValuesBeforeExecuting(alg): + return checkMovingWindow(alg, True) + + +def processCommand(alg): + configFile(alg, True) + + +def processOutputs(alg): + moveOutputTxtFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_simpson.py b/python/plugins/processing/algs/grass7/ext/r_li_simpson.py new file mode 100644 index 00000000000..56d44766586 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_simpson.py @@ -0,0 +1,36 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_simpson.py + --------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile + + +def checkParameterValuesBeforeExecuting(alg): + checkMovingWindow(alg) + + +def processCommand(alg): + configFile(alg) diff --git a/python/plugins/processing/algs/grass7/ext/r_li_simpson_ascii.py b/python/plugins/processing/algs/grass7/ext/r_li_simpson_ascii.py new file mode 100644 index 00000000000..dd236ecb816 --- /dev/null +++ b/python/plugins/processing/algs/grass7/ext/r_li_simpson_ascii.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- + +""" +*************************************************************************** + r_li_simpson_ascii.py + --------------------- + Date : February 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__ = 'February 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 r_li import checkMovingWindow, configFile, moveOutputTxtFile + + +def checkParameterValuesBeforeExecuting(alg): + return checkMovingWindow(alg, True) + + +def processCommand(alg): + configFile(alg, True) + + +def processOutputs(alg): + moveOutputTxtFile(alg)