| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| D8 Extreme Upslope Value (multifile) | ||
| d8flowpathextremeup | ||
| Stream Network Analysis tools | ||
| ParameterFile|-p|D8 Flow Directions Grid|True|False | ||
| ParameterFile|-sa|Upslope Values Grid|True|False | ||
| ParameterVector|-o|Outlets Shapefile|0|True | ||
| ParameterBoolean|-nc|Check for edge contamination|True | ||
| ParameterBoolean|-min|Use max upslope value|True | ||
| OutputDirectory|-ssa|Extereme Upslope Values Grid |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| D8 Distance To Streams (multifile) | ||
| d8hdisttostrm | ||
| Specialized Grid Analysis tools | ||
| ParameterFile|-p|D8 Flow Direction Grid|True|False | ||
| ParameterFile|-src|Stream Raster Grid|True|False | ||
| ParameterNumber|-thresh|Threshold|1|500|50 | ||
| OutputDirectory|-dist|Output Distance to Streams |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| D-Infinity Avalanche Runout (multifile) | ||
| dinfavalanche | ||
| Specialized Grid Analysis tools | ||
| ParameterFile|-ang|D-Infinity Flow Direction Grid|True|False | ||
| ParameterFile|-fel|Pit Filled Elevation Grid|True|False | ||
| ParameterFile|-ass|Avalanche Source Site Grid|True|False | ||
| ParameterNumber|-thresh|Proportion Threshold|0.00001|10.0|0.2 | ||
| ParameterNumber|-alpha|Alpha Angle Threshold|0|360|18 | ||
| ParameterBoolean|-direct|Measure distance along flow path|True | ||
| OutputDirectory|-rz|Runout Zone Grid | ||
| OutputDirectory|-dfs|Path Distance Grid |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| D-Infinity Concentration Limited Accumulation (multifile) | ||
| dinfconclimaccum | ||
| Specialized Grid Analysis tools | ||
| ParameterFile|-ang|D-Infinity Flow Direction Grid|True|False | ||
| ParameterFile|-dg|Disturbance Indicator Grid|True|False | ||
| ParameterFile|-dm|Decay Multiplier Grid|True|False | ||
| ParameterFile|-q|Effective Runoff Weight Grid|True|False | ||
| ParameterVector|-o|Outlets shapefile|0|True | ||
| ParameterNumber|-csol|Concentration Threshold|1.0|100.0|1.0 | ||
| ParameterBoolean|-nc|Check for edge contamination|True | ||
| OutputDirectory|-ctpt|Concentration Grid |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| D-Infinity Decaying Accumulation | ||
| dinfdecayaccum | ||
| Specialized Grid Analysis tools | ||
| ParameterFile|-ang|D-Infinity Flow Direction Grid|True|False | ||
| ParameterFile|-dm|Decay Multiplier Grid|True|False | ||
| ParameterFile|-wg|Weight Grid|True|True | ||
| ParameterVector|-o|Outlets Shapefile|0|True | ||
| ParameterBoolean|-nc|Check for edge contamination|True | ||
| OutputDirectory|-dsca|Decayed Specific Catchment Area Grid |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| D-Infinity Flow Directions (multifile) | ||
| dinfflowdir | ||
| Basic Grid Analysis tools | ||
| ParameterFile|-fel|Pit Filled Elevation Grid|True|False | ||
| OutputDirectory|-ang|D-Infinity Flow Directions Grid | ||
| OutputDirectory|-slp|D-Infinity Slope Grid |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| D-Infinity Reverse Accumulation (multifile) | ||
| dinfrevaccum | ||
| Specialized Grid Analysis tools | ||
| ParameterFile|-ang|D-Infinity Flow Direction Grid|True|False | ||
| ParameterFile|-wg|Weight Grid|True|False | ||
| OutputDirectory|-racc|Reverse Accumulation Grid | ||
| OutputDirectory|-dmax|Maximum Downslope Grid |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| D-Infinity Upslope Dependence (multifile) | ||
| dinfupdependence | ||
| Specialized Grid Analysis tools | ||
| ParameterFile|-ang|D-Infinity Flow Direction Grid|True|False | ||
| ParameterFile|-dg|Destination Grid|True|False | ||
| OutputDirectory|-dep|Output Upslope Dependence Grid |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| Gage Watershed (multifile) | ||
| gagewatershed | ||
| Stream Network Analysis tools | ||
| ParameterRaster|-p|D8 Flow Directions Grid|False | ||
| ParameterVector|-o|Gages Shapefile|0|False | ||
| OutputRaster|-gw|Gage Watershed Grid |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| Gage Watershed - 2 (multifile) | ||
| gagewatershed | ||
| Stream Network Analysis tools | ||
| ParameterRaster|-p|D8 Flow Directions Grid|False | ||
| ParameterVector|-o|Gages Shapefile|0|False | ||
| OutputRaster|-gw|Gage Watershed Grid | ||
| OutputFile|-id|Downstream Identifiers File |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| Move Outlets To Streams (multifile) | ||
| moveoutletstostrm | ||
| Stream Network Analysis tools | ||
| ParameterFile|-p|D8 Flow Direction Grid|True|False | ||
| ParameterFile|-src|Stream Raster Grid|True|False | ||
| ParameterVector|-o|Outlets Shapefile|0|False | ||
| ParameterNumber|-md|Maximum Number of Grid Cells to traverse|1|500|50 | ||
| OutputVector|-om|Output Outlet Shapefile |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| Pit Remove (multifile) | ||
| pitremove | ||
| Basic Grid Analysis tools | ||
| ParameterFile|-z|Elevation Grid|True|False | ||
| OutputDirectory|-fel|Pit Removed Elevation Grid |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| Select GT Threshold (multifile) | ||
| selectgtthreshold | ||
| Basic Grid Analysis tools | ||
| ParameterRaster|-z|Elevation Grid|False | ||
| ParameterNumber|-thresh|Threshold|0.0|999999.999999|0.0 | ||
| OutputRaster|-t|Output Grid |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| Slope Over Area Ratio (multifile) | ||
| slopearearatio | ||
| Specialized Grid Analysis tools | ||
| ParameterFile|-slp|Slope Grid|True|False | ||
| ParameterFile|-sca|Specific Catchment Area Grid|True|False | ||
| OutputDirectory|-sar|Slope Divided By Area Ratio Grid |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| Slope Average Down (multifile) | ||
| slopeavedown | ||
| Specialized Grid Analysis tools | ||
| ParameterFile|-p|D8 Flow Direction Grid|True|False | ||
| ParameterFile|-fel|Pit Filled Elevation Grid|True|False | ||
| ParameterNumber|-dn|Downslope Distance|1|500|50 | ||
| OutputDirectory|-slpd|Slope Average Down Grid |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| Stream Reach and Watershed (multifile) | ||
| streamnet | ||
| Stream Network Analysis tools | ||
| ParameterFile|-fel|Pit Filled Elevation Grid|True|False | ||
| ParameterFile|-p|D8 Flow Direction Grid|True|False | ||
| ParameterFile|-ad8|D8 Drainage Area|True|False | ||
| ParameterFile|-src|Stream Raster Grid|True|False | ||
| ParameterVector|-o|Outlets Shapefile as Network Nodes|0|True | ||
| ParameterBoolean|-sw|Delineate Single Watershed|False | ||
| OutputDirectory|-ord|Stream Order Grid | ||
| OutputDirectory|-w|Watershed Grid | ||
| OutputVector|-net|Stream Reach Shapefile | ||
| OutputFile|-tree|Network Connectivity Tree | ||
| OutputFile|-coord|Network Coordinates |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| Stream Definition By Threshold (multifile) | ||
| threshold | ||
| Stream Network Analysis tools | ||
| ParameterFile|-ssa|Accumulated Stream Source Grid|True|False | ||
| ParameterNumber|-thresh|Threshold|1|None|100 | ||
| ParameterFile|-mask|Mask Grid|True|True | ||
| OutputDirectory|-src|Stream Raster Grid |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| Topographic Wetness Index (multifile) | ||
| twi | ||
| Stream Network Analysis tools | ||
| ParameterRaster|-sca|D-Infinity Specific Catchment Area Grid|False | ||
| ParameterRaster|-slp|D-Infinity Slope Grid|False | ||
| OutputRaster|-twi|Topographic Wetness Index Grid |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| Gage Watershed | ||
| gagewatershed | ||
| Stream Network Analysis tools | ||
| ParameterRaster|-p|D8 Flow Directions Grid|False | ||
| ParameterVector|-o|Gages Shapefile|0|False | ||
| OutputRaster|-gw|Gage Watershed Grid |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| Gage Watershed - 2 | ||
| gagewatershed | ||
| Stream Network Analysis tools | ||
| ParameterRaster|-p|D8 Flow Directions Grid|False | ||
| ParameterVector|-o|Gages Shapefile|0|False | ||
| OutputRaster|-gw|Gage Watershed Grid | ||
| OutputFile|-id|Downstream Identifiers File |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| Select GT Threshold | ||
| selectgtthreshold | ||
| Basic Grid Analysis tools | ||
| ParameterRaster|-z|Elevation Grid|False | ||
| ParameterNumber|-thresh|Threshold|0.0|999999.999999|0.0 | ||
| OutputRaster|-t|Output Grid |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| Topographic Wetness Index | ||
| twi | ||
| Stream Network Analysis tools | ||
| ParameterRaster|-sca|D-Infinity Specific Catchment Area Grid|False | ||
| ParameterRaster|-slp|D-Infinity Slope Grid|False | ||
| OutputRaster|-twi|Topographic Wetness Index Grid |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| # -*- coding: utf-8 -*- | ||
|
|
||
| """ | ||
| *************************************************************************** | ||
| dinfdistdown_multi.py | ||
| --------------------- | ||
| Date : March 2015 | ||
| Copyright : (C) 2015 by Alexander Bruy | ||
| Email : alexander dot bruy at gmail dot com | ||
| *************************************************************************** | ||
| * * | ||
| * 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__ = 'Alexander Bruy' | ||
| __date__ = 'March 2015' | ||
| __copyright__ = '(C) 2015, Alexander Bruy' | ||
|
|
||
| # This will get replaced with a git SHA1 when you do a git archive | ||
|
|
||
| __revision__ = '$Format:%H$' | ||
|
|
||
| import os | ||
|
|
||
| from PyQt4.QtGui import QIcon | ||
|
|
||
| from processing.core.GeoAlgorithm import GeoAlgorithm | ||
| from processing.core.ProcessingConfig import ProcessingConfig | ||
| from processing.core.GeoAlgorithmExecutionException import \ | ||
| GeoAlgorithmExecutionException | ||
|
|
||
| from processing.core.parameters import ParameterFile | ||
| from processing.core.parameters import ParameterBoolean | ||
| from processing.core.parameters import ParameterSelection | ||
| from processing.core.outputs import OutputDirectory | ||
|
|
||
| from TauDEMUtils import TauDEMUtils | ||
|
|
||
|
|
||
| class DinfDistDownMulti(GeoAlgorithm): | ||
|
|
||
| DINF_FLOW_DIR_GRID = 'DINF_FLOW_DIR_GRID' | ||
| PIT_FILLED_GRID = 'PIT_FILLED_GRID' | ||
| STREAM_GRID = 'STREAM_GRID' | ||
| WEIGHT_PATH_GRID = 'WEIGHT_PATH_GRID' | ||
| STAT_METHOD = 'STAT_METHOD' | ||
| DIST_METHOD = 'DIST_METHOD' | ||
| EDGE_CONTAM = 'EDGE_CONTAM' | ||
|
|
||
| DIST_DOWN_GRID = 'DIST_DOWN_GRID' | ||
|
|
||
| STATISTICS = ['Minimum', 'Maximum', 'Average'] | ||
| STAT_DICT = {0: 'min', 1: 'max', 2: 'ave'} | ||
|
|
||
| DISTANCE = ['Pythagoras', 'Horizontal', 'Vertical', 'Surface'] | ||
| DIST_DICT = { | ||
| 0: 'p', | ||
| 1: 'h', | ||
| 2: 'v', | ||
| 3: 's', | ||
| } | ||
|
|
||
| def getIcon(self): | ||
| return QIcon(os.path.dirname(__file__) + '/../../images/taudem.png') | ||
|
|
||
| def defineCharacteristics(self): | ||
| self.name = 'D-Infinity Distance Down (multifile)' | ||
| self.cmdName = 'dinfdistdown' | ||
| self.group = 'Specialized Grid Analysis tools' | ||
|
|
||
| self.addParameter(ParameterFile(self.DINF_FLOW_DIR_GRID, | ||
| self.tr('D-Infinity Flow Direction Grid'), True, False)) | ||
| self.addParameter(ParameterFile(self.PIT_FILLED_GRID, | ||
| self.tr('Pit Filled Elevation Grid'), True, False)) | ||
| self.addParameter(ParameterFile(self.STREAM_GRID, | ||
| self.tr('Stream Raster Grid'), True, False)) | ||
| self.addParameter(ParameterFile(self.WEIGHT_PATH_GRID, | ||
| self.tr('Weight Path Grid'), True, True)) | ||
| self.addParameter(ParameterSelection(self.STAT_METHOD, | ||
| self.tr('Statistical Method'), self.STATISTICS, 2)) | ||
| self.addParameter(ParameterSelection(self.DIST_METHOD, | ||
| self.tr('Distance Method'), self.DISTANCE, 1)) | ||
| self.addParameter(ParameterBoolean(self.EDGE_CONTAM, | ||
| self.tr('Check for edge contamination'), True)) | ||
|
|
||
| self.addOutput(OutputDirectory(self.DIST_DOWN_GRID, | ||
| self.tr('D-Infinity Drop to Stream Grid'))) | ||
|
|
||
| def processAlgorithm(self, progress): | ||
| commands = [] | ||
| commands.append(os.path.join(TauDEMUtils.mpiexecPath(), 'mpiexec')) | ||
|
|
||
| processNum = ProcessingConfig.getSetting(TauDEMUtils.MPI_PROCESSES) | ||
| if processNum <= 0: | ||
| raise GeoAlgorithmExecutionException( | ||
| self.tr('Wrong number of MPI processes used. Please set ' | ||
| 'correct number before running TauDEM algorithms.')) | ||
|
|
||
| commands.append('-n') | ||
| commands.append(str(processNum)) | ||
| commands.append(os.path.join(TauDEMUtils.taudemMultifilePath(), self.cmdName)) | ||
| commands.append('-ang') | ||
| commands.append(self.getParameterValue(self.DINF_FLOW_DIR_GRID)) | ||
| commands.append('-fel') | ||
| commands.append(self.getParameterValue(self.PIT_FILLED_GRID)) | ||
| commands.append('-src') | ||
| commands.append(self.getParameterValue(self.STREAM_GRID)) | ||
| wg = self.getParameterValue(self.WEIGHT_PATH_GRID) | ||
| if wg is not None: | ||
| commands.append('-wg') | ||
| commands.append(self.getParameterValue(self.WEIGHT_PATH_GRID)) | ||
| commands.append('-m') | ||
| commands.append(str(self.STAT_DICT[self.getParameterValue( | ||
| self.STAT_METHOD)])) | ||
| commands.append(str(self.DIST_DICT[self.getParameterValue( | ||
| self.DIST_METHOD)])) | ||
| if str(self.getParameterValue(self.EDGE_CONTAM)).lower() == 'false': | ||
| commands.append('-nc') | ||
| commands.append('-dd') | ||
| commands.append(self.getOutputValue(self.DIST_DOWN_GRID)) | ||
|
|
||
| TauDEMUtils.executeTauDEM(commands, progress) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| # -*- coding: utf-8 -*- | ||
|
|
||
| """ | ||
| *************************************************************************** | ||
| dinfdistup_multi.py | ||
| --------------------- | ||
| Date : March 2015 | ||
| Copyright : (C) 2015 by Alexander Bruy | ||
| Email : alexander dot bruy at gmail dot com | ||
| *************************************************************************** | ||
| * * | ||
| * 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__ = 'Alexander Bruy' | ||
| __date__ = 'March 2015' | ||
| __copyright__ = '(C) 2015, Alexander Bruy' | ||
|
|
||
| # This will get replaced with a git SHA1 when you do a git archive | ||
|
|
||
| __revision__ = '$Format:%H$' | ||
|
|
||
| import os | ||
|
|
||
| from PyQt4.QtGui import QIcon | ||
|
|
||
| from processing.core.GeoAlgorithm import GeoAlgorithm | ||
| from processing.core.ProcessingConfig import ProcessingConfig | ||
| from processing.core.GeoAlgorithmExecutionException import \ | ||
| GeoAlgorithmExecutionException | ||
|
|
||
| from processing.core.parameters import ParameterFile | ||
| from processing.core.parameters import ParameterNumber | ||
| from processing.core.parameters import ParameterBoolean | ||
| from processing.core.parameters import ParameterSelection | ||
| from processing.core.outputs import OutputDirectory | ||
|
|
||
| from TauDEMUtils import TauDEMUtils | ||
|
|
||
|
|
||
| class DinfDistUpMulti(GeoAlgorithm): | ||
|
|
||
| DINF_FLOW_DIR_GRID = 'DINF_FLOW_DIR_GRID' | ||
| PIT_FILLED_GRID = 'PIT_FILLED_GRID' | ||
| SLOPE_GRID = 'SLOPE_GRID' | ||
| THRESHOLD = 'THRESHOLD' | ||
| STAT_METHOD = 'STAT_METHOD' | ||
| DIST_METHOD = 'DIST_METHOD' | ||
| EDGE_CONTAM = 'EDGE_CONTAM' | ||
|
|
||
| DIST_UP_GRID = 'DIST_UP_GRID' | ||
|
|
||
| STATISTICS = ['Minimum', 'Maximum', 'Average'] | ||
| STAT_DICT = {0: 'min', 1: 'max', 2: 'ave'} | ||
|
|
||
| DISTANCE = ['Pythagoras', 'Horizontal', 'Vertical', 'Surface'] | ||
| DIST_DICT = { | ||
| 0: 'p', | ||
| 1: 'h', | ||
| 2: 'v', | ||
| 3: 's', | ||
| } | ||
|
|
||
| def getIcon(self): | ||
| return QIcon(os.path.dirname(__file__) + '/../../images/taudem.png') | ||
|
|
||
| def defineCharacteristics(self): | ||
| self.name = 'D-Infinity Distance Up (multifile)' | ||
| self.cmdName = 'dinfdistup' | ||
| self.group = 'Specialized Grid Analysis tools' | ||
|
|
||
| self.addParameter(ParameterFile(self.DINF_FLOW_DIR_GRID, | ||
| self.tr('D-Infinity Flow Direction Grid'), True, False)) | ||
| self.addParameter(ParameterFile(self.PIT_FILLED_GRID, | ||
| self.tr('Pit Filled Elevation Grid'), True, False)) | ||
| self.addParameter(ParameterFile(self.SLOPE_GRID, | ||
| self.tr('Slope Grid'), True, False)) | ||
| self.addParameter(ParameterSelection(self.STAT_METHOD, | ||
| self.tr('Statistical Method'), self.STATISTICS, 2)) | ||
| self.addParameter(ParameterSelection(self.DIST_METHOD, | ||
| self.tr('Distance Method'), self.DISTANCE, 1)) | ||
| self.addParameter(ParameterNumber(self.THRESHOLD, | ||
| self.tr('Proportion Threshold'), 0, None, 0.5)) | ||
| self.addParameter(ParameterBoolean(self.EDGE_CONTAM, | ||
| self.tr('Check for edge contamination'), True)) | ||
|
|
||
| self.addOutput(OutputDirectory(self.DIST_UP_GRID, | ||
| self.tr('D-Infinity Distance Up'))) | ||
|
|
||
| def processAlgorithm(self, progress): | ||
| commands = [] | ||
| commands.append(os.path.join(TauDEMUtils.mpiexecPath(), 'mpiexec')) | ||
|
|
||
| processNum = ProcessingConfig.getSetting(TauDEMUtils.MPI_PROCESSES) | ||
| if processNum <= 0: | ||
| raise GeoAlgorithmExecutionException( | ||
| self.tr('Wrong number of MPI processes used. Please set ' | ||
| 'correct number before running TauDEM algorithms.')) | ||
|
|
||
| commands.append('-n') | ||
| commands.append(str(processNum)) | ||
| commands.append(os.path.join(TauDEMUtils.taudemMultifilePath(), self.cmdName)) | ||
| commands.append('-ang') | ||
| commands.append(self.getParameterValue(self.DINF_FLOW_DIR_GRID)) | ||
| commands.append('-fel') | ||
| commands.append(self.getParameterValue(self.PIT_FILLED_GRID)) | ||
| commands.append('-m') | ||
| commands.append(str(self.STAT_DICT[self.getParameterValue( | ||
| self.STAT_METHOD)])) | ||
| commands.append(str(self.DIST_DICT[self.getParameterValue( | ||
| self.DIST_METHOD)])) | ||
| commands.append('-thresh') | ||
| commands.append(str(self.getParameterValue(self.THRESHOLD))) | ||
| if str(self.getParameterValue(self.EDGE_CONTAM)).lower() == 'false': | ||
| commands.append('-nc') | ||
| commands.append('-du') | ||
| commands.append(self.getOutputValue(self.DIST_UP_GRID)) | ||
|
|
||
| TauDEMUtils.executeTauDEM(commands, progress) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,122 @@ | ||
| # -*- coding: utf-8 -*- | ||
|
|
||
| """ | ||
| *************************************************************************** | ||
| dinftranslimaccum2_multi.py | ||
| --------------------- | ||
| Date : March 2015 | ||
| Copyright : (C) 2015 by Alexander Bruy | ||
| Email : alexander dot bruy at gmail dot com | ||
| *************************************************************************** | ||
| * * | ||
| * 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__ = 'Alexander Bruy' | ||
| __date__ = 'March 2015' | ||
| __copyright__ = '(C) 2015, Alexander Bruy' | ||
|
|
||
| # This will get replaced with a git SHA1 when you do a git archive | ||
|
|
||
| __revision__ = '$Format:%H$' | ||
|
|
||
| import os | ||
|
|
||
| from PyQt4.QtGui import QIcon | ||
|
|
||
| from processing.core.GeoAlgorithm import GeoAlgorithm | ||
| from processing.core.ProcessingConfig import ProcessingConfig | ||
| from processing.core.GeoAlgorithmExecutionException import \ | ||
| GeoAlgorithmExecutionException | ||
|
|
||
| from processing.core.parameters import ParameterFile | ||
| from processing.core.parameters import ParameterVector | ||
| from processing.core.parameters import ParameterBoolean | ||
| from processing.core.outputs import OutputDirectory | ||
|
|
||
| from TauDEMUtils import TauDEMUtils | ||
|
|
||
|
|
||
| class DinfTransLimAccum2Multi(GeoAlgorithm): | ||
|
|
||
| DINF_FLOW_DIR_GRID = 'DINF_FLOW_DIR_GRID' | ||
| SUPPLY_GRID = 'SUPPLY_GRID' | ||
| CAPACITY_GRID = 'CAPACITY_GRID' | ||
| IN_CONCENTR_GRID = 'IN_CONCENTR_GRID' | ||
| OUTLETS_SHAPE = 'OUTLETS_SHAPE' | ||
| EDGE_CONTAM = 'EDGE_CONTAM' | ||
|
|
||
| TRANSP_LIM_ACCUM_GRID = 'TRANSP_LIM_ACCUM_GRID' | ||
| DEPOSITION_GRID = 'DEPOSITION_GRID' | ||
| OUT_CONCENTR_GRID = 'OUT_CONCENTR_GRID' | ||
|
|
||
| def getIcon(self): | ||
| return QIcon(os.path.dirname(__file__) + '/../../images/taudem.png') | ||
|
|
||
| def defineCharacteristics(self): | ||
| self.name = 'D-Infinity Transport Limited Accumulation - 2 (multifile)' | ||
| self.cmdName = 'dinftranslimaccum' | ||
| self.group = 'Specialized Grid Analysis tools' | ||
|
|
||
| self.addParameter(ParameterFile(self.DINF_FLOW_DIR_GRID, | ||
| self.tr('D-Infinity Flow Direction Grid'), True, False)) | ||
| self.addParameter(ParameterFile(self.SUPPLY_GRID, | ||
| self.tr('Supply Grid'), True, False)) | ||
| self.addParameter(ParameterFile(self.CAPACITY_GRID, | ||
| self.tr('Transport Capacity Grid'), True, False)) | ||
| self.addParameter(ParameterFile(self.IN_CONCENTR_GRID, | ||
| self.tr('Input Concentration Grid'), True, False)) | ||
| self.addParameter(ParameterVector(self.OUTLETS_SHAPE, | ||
| self.tr('Outlets Shapefile'), | ||
| [ParameterVector.VECTOR_TYPE_POINT], True)) | ||
| self.addParameter(ParameterBoolean(self.EDGE_CONTAM, | ||
| self.tr('Check for edge contamination'), True)) | ||
|
|
||
| self.addOutput(OutputDirectory(self.TRANSP_LIM_ACCUM_GRID, | ||
| self.tr('Transport Limited Accumulation Grid'))) | ||
| self.addOutput(OutputDirectory(self.DEPOSITION_GRID, | ||
| self.tr('Deposition Grid'))) | ||
| self.addOutput(OutputDirectory(self.OUT_CONCENTR_GRID, | ||
| self.tr('Output Concentration Grid'))) | ||
|
|
||
| def processAlgorithm(self, progress): | ||
| commands = [] | ||
| commands.append(os.path.join(TauDEMUtils.mpiexecPath(), 'mpiexec')) | ||
|
|
||
| processNum = ProcessingConfig.getSetting(TauDEMUtils.MPI_PROCESSES) | ||
| if processNum <= 0: | ||
| raise GeoAlgorithmExecutionException( | ||
| self.tr('Wrong number of MPI processes used. Please set ' | ||
| 'correct number before running TauDEM algorithms.')) | ||
|
|
||
| commands.append('-n') | ||
| commands.append(str(processNum)) | ||
| commands.append(os.path.join(TauDEMUtils.taudemMultifilePath(), self.cmdName)) | ||
| commands.append('-ang') | ||
| commands.append(self.getParameterValue(self.DINF_FLOW_DIR_GRID)) | ||
| commands.append('-tsup') | ||
| commands.append(self.getParameterValue(self.SUPPLY_GRID)) | ||
| commands.append('-tc') | ||
| commands.append(self.getParameterValue(self.CAPACITY_GRID)) | ||
| commands.append('-cs') | ||
| commands.append(self.getParameterValue(self.IN_CONCENTR_GRID)) | ||
| param = self.getParameterValue(self.OUTLETS_SHAPE) | ||
| if param is not None: | ||
| commands.append('-o') | ||
| commands.append(param) | ||
| if str(self.getParameterValue(self.EDGE_CONTAM)).lower() == 'false': | ||
| commands.append('-nc') | ||
|
|
||
| commands.append('-tla') | ||
| commands.append(self.getOutputValue(self.TRANSP_LIM_ACCUM_GRID)) | ||
| commands.append('-tdep') | ||
| commands.append(self.getOutputValue(self.DEPOSITION_GRID)) | ||
| commands.append('-ctpt') | ||
| commands.append(self.getOutputValue(self.OUT_CONCENTR_GRID)) | ||
|
|
||
| TauDEMUtils.executeTauDEM(commands, progress) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| # -*- coding: utf-8 -*- | ||
|
|
||
| """ | ||
| *************************************************************************** | ||
| dinftranslimaccum_multi.py | ||
| --------------------- | ||
| Date : March 2015 | ||
| Copyright : (C) 2015 by Alexander Bruy | ||
| Email : alexander dot bruy at gmail dot com | ||
| *************************************************************************** | ||
| * * | ||
| * 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__ = 'Alexander Bruy' | ||
| __date__ = 'March 2015' | ||
| __copyright__ = '(C) 2015, Alexander Bruy' | ||
|
|
||
| # This will get replaced with a git SHA1 when you do a git archive | ||
|
|
||
| __revision__ = '$Format:%H$' | ||
|
|
||
| import os | ||
|
|
||
| from PyQt4.QtGui import QIcon | ||
|
|
||
| from processing.core.GeoAlgorithm import GeoAlgorithm | ||
| from processing.core.ProcessingConfig import ProcessingConfig | ||
| from processing.core.GeoAlgorithmExecutionException import \ | ||
| GeoAlgorithmExecutionException | ||
|
|
||
| from processing.core.parameters import ParameterFile | ||
| from processing.core.parameters import ParameterVector | ||
| from processing.core.parameters import ParameterBoolean | ||
| from processing.core.outputs import OutputDirectory | ||
|
|
||
| from TauDEMUtils import TauDEMUtils | ||
|
|
||
|
|
||
| class DinfTransLimAccumMulti(GeoAlgorithm): | ||
|
|
||
| DINF_FLOW_DIR_GRID = 'DINF_FLOW_DIR_GRID' | ||
| SUPPLY_GRID = 'SUPPLY_GRID' | ||
| CAPACITY_GRID = 'CAPACITY_GRID' | ||
| IN_CONCENTR_GRID = 'IN_CONCENTR_GRID' | ||
| OUTLETS_SHAPE = 'OUTLETS_SHAPE' | ||
| EDGE_CONTAM = 'EDGE_CONTAM' | ||
|
|
||
| TRANSP_LIM_ACCUM_GRID = 'TRANSP_LIM_ACCUM_GRID' | ||
| DEPOSITION_GRID = 'DEPOSITION_GRID' | ||
| OUT_CONCENTR_GRID = 'OUT_CONCENTR_GRID' | ||
|
|
||
| def getIcon(self): | ||
| return QIcon(os.path.dirname(__file__) + '/../../images/taudem.png') | ||
|
|
||
| def defineCharacteristics(self): | ||
| self.name = 'D-Infinity Transport Limited Accumulation (multifile)' | ||
| self.cmdName = 'dinftranslimaccum' | ||
| self.group = 'Specialized Grid Analysis tools' | ||
|
|
||
| self.addParameter(ParameterFile(self.DINF_FLOW_DIR_GRID, | ||
| self.tr('D-Infinity Flow Direction Grid'), True, False)) | ||
| self.addParameter(ParameterFile(self.SUPPLY_GRID, | ||
| self.tr('Supply Grid'), True, False)) | ||
| self.addParameter(ParameterFile(self.CAPACITY_GRID, | ||
| self.tr('Transport Capacity Grid'), True, False)) | ||
| self.addParameter(ParameterVector(self.OUTLETS_SHAPE, | ||
| self.tr('Outlets Shapefile'), | ||
| [ParameterVector.VECTOR_TYPE_POINT], True)) | ||
| self.addParameter(ParameterBoolean(self.EDGE_CONTAM, | ||
| self.tr('Check for edge contamination'), True)) | ||
|
|
||
| self.addOutput(OutputDirectory(self.TRANSP_LIM_ACCUM_GRID, | ||
| self.tr('Transport Limited Accumulation Grid'))) | ||
| self.addOutput(OutputDirectory(self.DEPOSITION_GRID, | ||
| self.tr('Deposition Grid'))) | ||
|
|
||
| def processAlgorithm(self, progress): | ||
| commands = [] | ||
| commands.append(os.path.join(TauDEMUtils.mpiexecPath(), 'mpiexec')) | ||
|
|
||
| processNum = ProcessingConfig.getSetting(TauDEMUtils.MPI_PROCESSES) | ||
| if processNum <= 0: | ||
| raise GeoAlgorithmExecutionException( | ||
| self.tr('Wrong number of MPI processes used. Please set ' | ||
| 'correct number before running TauDEM algorithms.')) | ||
|
|
||
| commands.append('-n') | ||
| commands.append(str(processNum)) | ||
| commands.append(os.path.join(TauDEMUtils.taudemMultifilePath(), self.cmdName)) | ||
| commands.append('-ang') | ||
| commands.append(self.getParameterValue(self.DINF_FLOW_DIR_GRID)) | ||
| commands.append('-tsup') | ||
| commands.append(self.getParameterValue(self.SUPPLY_GRID)) | ||
| commands.append('-tc') | ||
| commands.append(self.getParameterValue(self.CAPACITY_GRID)) | ||
| param = self.getParameterValue(self.OUTLETS_SHAPE) | ||
| if param is not None: | ||
| commands.append('-o') | ||
| commands.append(param) | ||
| if str(self.getParameterValue(self.EDGE_CONTAM)).lower() == 'false': | ||
| commands.append('-nc') | ||
|
|
||
| commands.append('-tla') | ||
| commands.append(self.getOutputValue(self.TRANSP_LIM_ACCUM_GRID)) | ||
| commands.append('-tdep') | ||
| commands.append(self.getOutputValue(self.DEPOSITION_GRID)) | ||
|
|
||
| TauDEMUtils.executeTauDEM(commands, progress) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,124 @@ | ||
| # -*- coding: utf-8 -*- | ||
|
|
||
| """ | ||
| *************************************************************************** | ||
| dropanalysis_multi.py | ||
| --------------------- | ||
| Date : March 2015 | ||
| Copyright : (C) 2015 by Alexander Bruy | ||
| Email : alexander dot bruy at gmail dot com | ||
| *************************************************************************** | ||
| * * | ||
| * 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__ = 'Alexander Bruy' | ||
| __date__ = 'March 2015' | ||
| __copyright__ = '(C) 2015, Alexander Bruy' | ||
|
|
||
| # This will get replaced with a git SHA1 when you do a git archive | ||
|
|
||
| __revision__ = '$Format:%H$' | ||
|
|
||
| import os | ||
|
|
||
| from PyQt4.QtGui import QIcon | ||
|
|
||
| from processing.core.GeoAlgorithm import GeoAlgorithm | ||
| from processing.core.ProcessingConfig import ProcessingConfig | ||
| from processing.core.GeoAlgorithmExecutionException import \ | ||
| GeoAlgorithmExecutionException | ||
|
|
||
| from processing.core.parameters import ParameterFile | ||
| from processing.core.parameters import ParameterVector | ||
| from processing.core.parameters import ParameterNumber | ||
| from processing.core.parameters import ParameterSelection | ||
| from processing.core.outputs import OutputFile | ||
|
|
||
| from TauDEMUtils import TauDEMUtils | ||
|
|
||
|
|
||
| class DropAnalysisMulti(GeoAlgorithm): | ||
|
|
||
| PIT_FILLED_GRID = 'PIT_FILLED_GRID' | ||
| D8_CONTRIB_AREA_GRID = 'D8_CONTRIB_AREA_GRID' | ||
| D8_FLOW_DIR_GRID = 'D8_FLOW_DIR_GRID' | ||
| ACCUM_STREAM_SOURCE_GRID = 'ACCUM_STREAM_SOURCE_GRID' | ||
| OUTLETS_SHAPE = 'OUTLETS_SHAPE' | ||
| MIN_TRESHOLD = 'MIN_TRESHOLD' | ||
| MAX_THRESHOLD = 'MAX_THRESHOLD' | ||
| TRESHOLD_NUM = 'TRESHOLD_NUM' | ||
| STEP_TYPE = 'STEP_TYPE' | ||
|
|
||
| DROP_ANALYSIS_FILE = 'DROP_ANALYSIS_FILE' | ||
|
|
||
| STEPS = ['Logarithmic', 'Linear'] | ||
|
|
||
| def getIcon(self): | ||
| return QIcon(os.path.dirname(__file__) + '/../../images/taudem.png') | ||
|
|
||
| def defineCharacteristics(self): | ||
| self.name = 'Stream Drop Analysis (multifile)' | ||
| self.cmdName = 'dropanalysis' | ||
| self.group = 'Stream Network Analysis tools' | ||
|
|
||
| self.addParameter(ParameterFile(self.D8_CONTRIB_AREA_GRID, | ||
| self.tr('D8 Contributing Area Grid'), True, False)) | ||
| self.addParameter(ParameterFile(self.D8_FLOW_DIR_GRID, | ||
| self.tr('D8 Flow Direction Grid'), True, False)) | ||
| self.addParameter(ParameterFile(self.PIT_FILLED_GRID, | ||
| self.tr('Pit Filled Elevation Grid'), True, False)) | ||
| self.addParameter(ParameterFile(self.ACCUM_STREAM_SOURCE_GRID, | ||
| self.tr('Accumulated Stream Source Grid'), True, False)) | ||
| self.addParameter(ParameterVector(self.OUTLETS_SHAPE, | ||
| self.tr('Outlets Shapefile'), | ||
| [ParameterVector.VECTOR_TYPE_POINT], False)) | ||
| self.addParameter(ParameterNumber(self.MIN_TRESHOLD, | ||
| self.tr('Minimum Threshold'), 0, None, 5)) | ||
| self.addParameter(ParameterNumber(self.MAX_THRESHOLD, | ||
| self.tr('Maximum Threshold'), 0, None, 500)) | ||
| self.addParameter(ParameterNumber(self.TRESHOLD_NUM, | ||
| self.tr('Number of Threshold Values'), 0, None, 10)) | ||
| self.addParameter(ParameterSelection(self.STEP_TYPE, | ||
| self.tr('Spacing for Threshold Values'), self.STEPS, 0)) | ||
|
|
||
| self.addOutput(OutputFile(self.DROP_ANALYSIS_FILE, | ||
| self.tr('D-Infinity Drop to Stream Grid'))) | ||
|
|
||
| def processAlgorithm(self, progress): | ||
| commands = [] | ||
| commands.append(os.path.join(TauDEMUtils.mpiexecPath(), 'mpiexec')) | ||
|
|
||
| processNum = ProcessingConfig.getSetting(TauDEMUtils.MPI_PROCESSES) | ||
| if processNum <= 0: | ||
| raise GeoAlgorithmExecutionException( | ||
| self.tr('Wrong number of MPI processes used. Please set ' | ||
| 'correct number before running TauDEM algorithms.')) | ||
|
|
||
| commands.append('-n') | ||
| commands.append(str(processNum)) | ||
| commands.append(os.path.join(TauDEMUtils.taudemMultifilePath(), self.cmdName)) | ||
| commands.append('-ad8') | ||
| commands.append(self.getParameterValue(self.D8_CONTRIB_AREA_GRID)) | ||
| commands.append('-p') | ||
| commands.append(self.getParameterValue(self.D8_FLOW_DIR_GRID)) | ||
| commands.append('-fel') | ||
| commands.append(self.getParameterValue(self.PIT_FILLED_GRID)) | ||
| commands.append('-ssa') | ||
| commands.append(self.getParameterValue(self.ACCUM_STREAM_SOURCE_GRID)) | ||
| commands.append('-o') | ||
| commands.append(self.getParameterValue(self.OUTLETS_SHAPE)) | ||
| commands.append('-par') | ||
| commands.append(str(self.getParameterValue(self.MIN_TRESHOLD))) | ||
| commands.append(str(self.getParameterValue(self.MAX_THRESHOLD))) | ||
| commands.append(str(self.getParameterValue(self.TRESHOLD_NUM))) | ||
| commands.append(str(self.getParameterValue(self.STEPS))) | ||
| commands.append('-drp') | ||
| commands.append(self.getOutputValue(self.DROP_ANALYSIS_FILE)) | ||
|
|
||
| TauDEMUtils.executeTauDEM(commands, progress) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| # -*- coding: utf-8 -*- | ||
|
|
||
| """ | ||
| *************************************************************************** | ||
| gridnet_multi.py | ||
| --------------------- | ||
| Date : March 2015 | ||
| Copyright : (C) 2015 by Alexander Bruy | ||
| Email : alexander dot bruy at gmail dot com | ||
| *************************************************************************** | ||
| * * | ||
| * 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__ = 'Alexander Bruy' | ||
| __date__ = 'March 2015' | ||
| __copyright__ = '(C) 2015, Alexander Bruy' | ||
|
|
||
| # This will get replaced with a git SHA1 when you do a git archive | ||
|
|
||
| __revision__ = '$Format:%H$' | ||
|
|
||
| import os | ||
|
|
||
| from PyQt4.QtGui import QIcon | ||
|
|
||
| from processing.core.GeoAlgorithm import GeoAlgorithm | ||
| from processing.core.ProcessingConfig import ProcessingConfig | ||
| from processing.core.GeoAlgorithmExecutionException import \ | ||
| GeoAlgorithmExecutionException | ||
|
|
||
| from processing.core.parameters import ParameterFile | ||
| from processing.core.parameters import ParameterVector | ||
| from processing.core.parameters import ParameterNumber | ||
| from processing.core.outputs import OutputDirectory | ||
|
|
||
| from TauDEMUtils import TauDEMUtils | ||
|
|
||
|
|
||
| class GridNetMulti(GeoAlgorithm): | ||
|
|
||
| D8_FLOW_DIR_GRID = 'D8_FLOW_DIR_GRID' | ||
| OUTLETS_SHAPE = 'OUTLETS_SHAPE' | ||
| MASK_GRID = 'MASK_GRID' | ||
| THRESHOLD = 'THRESHOLD' | ||
|
|
||
| LONGEST_LEN_GRID = 'LONGEST_LEN_GRID' | ||
| TOTAL_LEN_GRID = 'TOTAL_LEN_GRID' | ||
| STRAHLER_GRID = 'STRAHLER_GRID' | ||
|
|
||
| def getIcon(self): | ||
| return QIcon(os.path.dirname(__file__) + '/../../images/taudem.png') | ||
|
|
||
| def defineCharacteristics(self): | ||
| self.name = 'Grid Network (multifile)' | ||
| self.cmdName = 'gridnet' | ||
| self.group = 'Basic Grid Analysis tools' | ||
|
|
||
| self.addParameter(ParameterFile(self.D8_FLOW_DIR_GRID, | ||
| self.tr('D8 Flow Direction Grid'), True, False)) | ||
| self.addParameter(ParameterVector(self.OUTLETS_SHAPE, | ||
| self.tr('Outlets Shapefile'), | ||
| [ParameterVector.VECTOR_TYPE_POINT], True)) | ||
| self.addParameter(ParameterFile(self.MASK_GRID, | ||
| self.tr('Mask Grid'), True, True)) | ||
| self.addParameter(ParameterNumber(self.THRESHOLD, | ||
| self.tr('Mask Threshold'), 0, None, 100)) | ||
|
|
||
| self.addOutput(OutputDirectory(self.LONGEST_LEN_GRID, | ||
| self.tr('Longest Upslope Length Grid'))) | ||
| self.addOutput(OutputDirectory(self.TOTAL_LEN_GRID, | ||
| self.tr('Total Upslope Length Grid'))) | ||
| self.addOutput(OutputDirectory(self.STRAHLER_GRID, | ||
| self.tr('Strahler Network Order Grid'))) | ||
|
|
||
| def processAlgorithm(self, progress): | ||
| commands = [] | ||
| commands.append(os.path.join(TauDEMUtils.mpiexecPath(), 'mpiexec')) | ||
|
|
||
| processNum = ProcessingConfig.getSetting(TauDEMUtils.MPI_PROCESSES) | ||
| if processNum <= 0: | ||
| raise GeoAlgorithmExecutionException( | ||
| self.tr('Wrong number of MPI processes used. Please set ' | ||
| 'correct number before running TauDEM algorithms.')) | ||
|
|
||
| commands.append('-n') | ||
| commands.append(str(processNum)) | ||
| commands.append(os.path.join(TauDEMUtils.taudemMultifilePath(), self.cmdName)) | ||
| commands.append('-p') | ||
| commands.append(self.getParameterValue(self.D8_FLOW_DIR_GRID)) | ||
| param = self.getParameterValue(self.OUTLETS_SHAPE) | ||
| if param is not None: | ||
| commands.append('-o') | ||
| commands.append(param) | ||
| param = self.getParameterValue(self.MASK_GRID) | ||
| if param is not None: | ||
| commands.append('-mask') | ||
| commands.append(param) | ||
| commands.append('-thresh') | ||
| commands.append(self.getParameterValue(self.THRESHOLD)) | ||
|
|
||
| commands.append('-plen') | ||
| commands.append(self.getOutputValue(self.LONGEST_LEN_GRID)) | ||
| commands.append('-tlen') | ||
| commands.append(self.getOutputValue(self.TOTAL_LEN_GRID)) | ||
| commands.append('-gord') | ||
| commands.append(self.getOutputValue(self.STRAHLER_GRID)) | ||
|
|
||
| TauDEMUtils.executeTauDEM(commands, progress) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| # -*- coding: utf-8 -*- | ||
|
|
||
| """ | ||
| *************************************************************************** | ||
| lengtharea_multi.py | ||
| --------------------- | ||
| Date : March 2015 | ||
| Copyright : (C) 2015 by Alexander Bruy | ||
| Email : alexander dot bruy at gmail dot com | ||
| *************************************************************************** | ||
| * * | ||
| * 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__ = 'Alexander Bruy' | ||
| __date__ = 'March 2015' | ||
| __copyright__ = '(C) 2015, Alexander Bruy' | ||
|
|
||
| # This will get replaced with a git SHA1 when you do a git archive | ||
|
|
||
| __revision__ = '$Format:%H$' | ||
|
|
||
| import os | ||
|
|
||
| from PyQt4.QtGui import QIcon | ||
|
|
||
| from processing.core.GeoAlgorithm import GeoAlgorithm | ||
| from processing.core.ProcessingConfig import ProcessingConfig | ||
| from processing.core.GeoAlgorithmExecutionException import \ | ||
| GeoAlgorithmExecutionException | ||
|
|
||
| from processing.core.parameters import ParameterFile | ||
| from processing.core.parameters import ParameterNumber | ||
| from processing.core.outputs import OutputDirectory | ||
|
|
||
| from TauDEMUtils import TauDEMUtils | ||
|
|
||
|
|
||
| class LengthAreaMulti(GeoAlgorithm): | ||
|
|
||
| LENGTH_GRID = 'LENGTH_GRID' | ||
| CONTRIB_AREA_GRID = 'CONTRIB_AREA_GRID' | ||
| THRESHOLD = 'THRESHOLD' | ||
| EXPONENT = 'EXPONENT' | ||
|
|
||
| STREAM_SOURCE_GRID = 'STREAM_SOURCE_GRID' | ||
|
|
||
| def getIcon(self): | ||
| return QIcon(os.path.dirname(__file__) + '/../../images/taudem.png') | ||
|
|
||
| def defineCharacteristics(self): | ||
| self.name = 'Length Area Stream Source (multifile)' | ||
| self.cmdName = 'lengtharea' | ||
| self.group = 'Stream Network Analysis tools' | ||
|
|
||
| self.addParameter(ParameterFile(self.LENGTH_GRID, | ||
| self.tr('Length Grid'), True, False)) | ||
| self.addParameter(ParameterFile(self.CONTRIB_AREA_GRID, | ||
| self.tr('Contributing Area Grid'), True, False)) | ||
| self.addParameter(ParameterNumber(self.THRESHOLD, | ||
| self.tr('Threshold'), 0, None, 0.03)) | ||
| self.addParameter(ParameterNumber(self.EXPONENT, | ||
| self.tr('Exponent'), 0, None, 1.3)) | ||
|
|
||
| self.addOutput(OutputDirectory(self.STREAM_SOURCE_GRID, | ||
| self.tr('Stream Source Grid'))) | ||
|
|
||
| def processAlgorithm(self, progress): | ||
| commands = [] | ||
| commands.append(os.path.join(TauDEMUtils.mpiexecPath(), 'mpiexec')) | ||
|
|
||
| processNum = ProcessingConfig.getSetting(TauDEMUtils.MPI_PROCESSES) | ||
| if processNum <= 0: | ||
| raise GeoAlgorithmExecutionException( | ||
| self.tr('Wrong number of MPI processes used. Please set ' | ||
| 'correct number before running TauDEM algorithms.')) | ||
|
|
||
| commands.append('-n') | ||
| commands.append(str(processNum)) | ||
| commands.append(os.path.join(TauDEMUtils.taudemMultifilePath(), self.cmdName)) | ||
| commands.append('-plen') | ||
| commands.append(self.getParameterValue(self.LENGTH_GRID)) | ||
| commands.append('-ad8') | ||
| commands.append(self.getParameterValue(self.CONTRIB_AREA_GRID)) | ||
| commands.append('-par') | ||
| commands.append(str(self.getParameterValue(self.THRESHOLD))) | ||
| commands.append(str(self.getParameterValue(self.EXPONENT))) | ||
| commands.append('-ss') | ||
| commands.append(self.getOutputValue(self.STREAM_SOURCE_GRID)) | ||
|
|
||
| TauDEMUtils.executeTauDEM(commands, progress) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,94 @@ | ||
| # -*- coding: utf-8 -*- | ||
|
|
||
| """ | ||
| *************************************************************************** | ||
| peukerdouglas_multi.py | ||
| --------------------- | ||
| Date : March 2015 | ||
| Copyright : (C) 2015 by Alexander Bruy | ||
| Email : alexander dot bruy at gmail dot com | ||
| *************************************************************************** | ||
| * * | ||
| * 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__ = 'Alexander Bruy' | ||
| __date__ = 'March 2015' | ||
| __copyright__ = '(C) 2015, Alexander Bruy' | ||
|
|
||
| # This will get replaced with a git SHA1 when you do a git archive | ||
|
|
||
| __revision__ = '$Format:%H$' | ||
|
|
||
| import os | ||
| from PyQt4.QtGui import QIcon | ||
|
|
||
| from processing.core.GeoAlgorithm import GeoAlgorithm | ||
| from processing.core.ProcessingConfig import ProcessingConfig | ||
| from processing.core.GeoAlgorithmExecutionException import \ | ||
| GeoAlgorithmExecutionException | ||
|
|
||
| from processing.core.parameters import ParameterFile | ||
| from processing.core.parameters import ParameterNumber | ||
| from processing.core.outputs import OutputDirectory | ||
|
|
||
| from TauDEMUtils import TauDEMUtils | ||
|
|
||
|
|
||
| class PeukerDouglasMulti(GeoAlgorithm): | ||
|
|
||
| ELEVATION_GRID = 'ELEVATION_GRID' | ||
| CENTER_WEIGHT = 'CENTER_WEIGHT' | ||
| SIDE_WEIGHT = 'SIDE_WEIGHT' | ||
| DIAGONAL_WEIGHT = 'DIAGONAL_WEIGHT' | ||
|
|
||
| STREAM_SOURCE_GRID = 'STREAM_SOURCE_GRID' | ||
|
|
||
| def getIcon(self): | ||
| return QIcon(os.path.dirname(__file__) + '/../../images/taudem.png') | ||
|
|
||
| def defineCharacteristics(self): | ||
| self.name = 'Peuker Douglas (multifile)' | ||
| self.cmdName = 'peukerdouglas' | ||
| self.group = 'Stream Network Analysis tools' | ||
|
|
||
| self.addParameter(ParameterFile(self.ELEVATION_GRID, | ||
| self.tr('Elevation Grid'), True, False)) | ||
| self.addParameter(ParameterNumber(self.CENTER_WEIGHT, | ||
| self.tr('Center Smoothing Weight'), 0, None, 0.4)) | ||
| self.addParameter(ParameterNumber(self.SIDE_WEIGHT, | ||
| self.tr('Side Smoothing Weight'), 0, None, 0.1)) | ||
| self.addParameter(ParameterNumber(self.DIAGONAL_WEIGHT, | ||
| self.tr('Diagonal Smoothing Weight'), 0, None, 0.05)) | ||
|
|
||
| self.addOutput(OutputDirectory(self.STREAM_SOURCE_GRID, | ||
| self.tr('Stream Source Grid'))) | ||
|
|
||
| def processAlgorithm(self, progress): | ||
| commands = [] | ||
| commands.append(os.path.join(TauDEMUtils.mpiexecPath(), 'mpiexec')) | ||
|
|
||
| processNum = ProcessingConfig.getSetting(TauDEMUtils.MPI_PROCESSES) | ||
| if processNum <= 0: | ||
| raise GeoAlgorithmExecutionException( | ||
| self.tr('Wrong number of MPI processes used. Please set ' | ||
| 'correct number before running TauDEM algorithms.')) | ||
|
|
||
| commands.append('-n') | ||
| commands.append(str(processNum)) | ||
| commands.append(os.path.join(TauDEMUtils.taudemMultifilePath(), self.cmdName)) | ||
| commands.append('-fel') | ||
| commands.append(self.getParameterValue(self.ELEVATION_GRID)) | ||
| commands.append('-par') | ||
| commands.append(str(self.getParameterValue(self.CENTER_WEIGHT))) | ||
| commands.append(str(self.getParameterValue(self.SIDE_WEIGHT))) | ||
| commands.append(str(self.getParameterValue(self.DIAGONAL_WEIGHT))) | ||
| commands.append('-ss') | ||
| commands.append(self.getOutputValue(self.STREAM_SOURCE_GRID)) | ||
|
|
||
| TauDEMUtils.executeTauDEM(commands, progress) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,96 @@ | ||
| # -*- coding: utf-8 -*- | ||
|
|
||
| """ | ||
| *************************************************************************** | ||
| slopearea_multi.py | ||
| --------------------- | ||
| Date : March 2015 | ||
| Copyright : (C) 2015 by Alexander Bruy | ||
| Email : alexander dot bruy at gmail dot com | ||
| *************************************************************************** | ||
| * * | ||
| * 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__ = 'Alexander Bruy' | ||
| __date__ = 'March 2015' | ||
| __copyright__ = '(C) 2015, Alexander Bruy' | ||
|
|
||
| # This will get replaced with a git SHA1 when you do a git archive | ||
|
|
||
| __revision__ = '$Format:%H$' | ||
|
|
||
| import os | ||
|
|
||
| from PyQt4.QtGui import QIcon | ||
|
|
||
| from processing.core.GeoAlgorithm import GeoAlgorithm | ||
| from processing.core.ProcessingConfig import ProcessingConfig | ||
| from processing.core.GeoAlgorithmExecutionException import \ | ||
| GeoAlgorithmExecutionException | ||
|
|
||
| from processing.core.parameters import ParameterFile | ||
| from processing.core.parameters import ParameterNumber | ||
| from processing.core.outputs import OutputDirectory | ||
|
|
||
| from TauDEMUtils import TauDEMUtils | ||
|
|
||
|
|
||
| class SlopeAreaMulti(GeoAlgorithm): | ||
|
|
||
| SLOPE_GRID = 'SLOPE_GRID' | ||
| AREA_GRID = 'AREA_GRID' | ||
| SLOPE_EXPONENT = 'SLOPE_EXPONENT' | ||
| AREA_EXPONENT = 'AREA_EXPONENT' | ||
|
|
||
| SLOPE_AREA_GRID = 'SLOPE_AREA_GRID' | ||
|
|
||
| def getIcon(self): | ||
| return QIcon(os.path.dirname(__file__) + '/../../images/taudem.png') | ||
|
|
||
| def defineCharacteristics(self): | ||
| self.name = 'Slope Area Combination (multifile)' | ||
| self.cmdName = 'slopearea' | ||
| self.group = 'Stream Network Analysis tools' | ||
|
|
||
| self.addParameter(ParameterFile(self.SLOPE_GRID, | ||
| self.tr('Slope Grid'), True, False)) | ||
| self.addParameter(ParameterFile(self.AREA_GRID, | ||
| self.tr('Contributing Area Grid'), True, False)) | ||
| self.addParameter(ParameterNumber(self.SLOPE_EXPONENT, | ||
| self.tr('Slope Exponent'), 0, None, 2)) | ||
| self.addParameter(ParameterNumber(self.AREA_EXPONENT, | ||
| self.tr('Area Exponent'), 0, None, 1)) | ||
|
|
||
| self.addOutput(OutputDirectory(self.SLOPE_AREA_GRID, | ||
| self.tr('Slope Area Grid'))) | ||
|
|
||
| def processAlgorithm(self, progress): | ||
| commands = [] | ||
| commands.append(os.path.join(TauDEMUtils.mpiexecPath(), 'mpiexec')) | ||
|
|
||
| processNum = ProcessingConfig.getSetting(TauDEMUtils.MPI_PROCESSES) | ||
| if processNum <= 0: | ||
| raise GeoAlgorithmExecutionException( | ||
| self.tr('Wrong number of MPI processes used. Please set ' | ||
| 'correct number before running TauDEM algorithms.')) | ||
|
|
||
| commands.append('-n') | ||
| commands.append(str(processNum)) | ||
| commands.append(os.path.join(TauDEMUtils.taudemMultifilePath(), self.cmdName)) | ||
| commands.append('-slp') | ||
| commands.append(self.getParameterValue(self.SLOPE_GRID)) | ||
| commands.append('-sca') | ||
| commands.append(self.getParameterValue(self.AREA_GRID)) | ||
| commands.append('-par') | ||
| commands.append(str(self.getParameterValue(self.SLOPE_EXPONENT))) | ||
| commands.append(str(self.getParameterValue(self.AREA_EXPONENT))) | ||
| commands.append('-sa') | ||
| commands.append(self.getOutputValue(self.SLOPE_AREA_GRID)) | ||
|
|
||
| TauDEMUtils.executeTauDEM(commands, progress) |