Skip to content
Permalink
Browse files

[processing] remove obsolete TauDEM multifile stuff

  • Loading branch information
alexbruy committed Aug 23, 2016
1 parent 3bfd998 commit 7866bdadf188cc2bae2d781484122e0f43f24df4
Showing with 54 additions and 1,395 deletions.
  1. +29 −27 python/plugins/processing/algs/taudem/TauDEMAlgorithm.py
  2. +23 −57 python/plugins/processing/algs/taudem/TauDEMAlgorithmProvider.py
  3. +0 −122 python/plugins/processing/algs/taudem/TauDEMMultifileAlgorithm.py
  4. +2 −18 python/plugins/processing/algs/taudem/TauDEMUtils.py
  5. 0 python/plugins/processing/algs/taudem/description/{single → }/aread8.txt
  6. 0 python/plugins/processing/algs/taudem/description/{single → }/areadinf.txt
  7. 0 python/plugins/processing/algs/taudem/description/{single → }/d8flowdir.txt
  8. 0 python/plugins/processing/algs/taudem/description/{single → }/d8flowpathextremeup.txt
  9. 0 python/plugins/processing/algs/taudem/description/{single → }/d8hdisttostrm.txt
  10. 0 python/plugins/processing/algs/taudem/description/{single → }/dinfavalanche.txt
  11. 0 python/plugins/processing/algs/taudem/description/{single → }/dinfconclimaccum.txt
  12. 0 python/plugins/processing/algs/taudem/description/{single → }/dinfdecayaccum.txt
  13. 0 python/plugins/processing/algs/taudem/description/{single → }/dinfflowdir.txt
  14. 0 python/plugins/processing/algs/taudem/description/{single → }/dinfrevaccum.txt
  15. 0 python/plugins/processing/algs/taudem/description/{single → }/dinfupdependence.txt
  16. 0 python/plugins/processing/algs/taudem/description/{single → }/gagewatershed.txt
  17. 0 python/plugins/processing/algs/taudem/description/{single → }/gagewatershed2.txt
  18. 0 python/plugins/processing/algs/taudem/description/{single → }/moveoutletstostrm.txt
  19. +0 −8 python/plugins/processing/algs/taudem/description/multi/aread8.txt
  20. +0 −8 python/plugins/processing/algs/taudem/description/multi/areadinf.txt
  21. +0 −6 python/plugins/processing/algs/taudem/description/multi/d8flowdir.txt
  22. +0 −9 python/plugins/processing/algs/taudem/description/multi/d8flowpathextremeup.txt
  23. +0 −7 python/plugins/processing/algs/taudem/description/multi/d8hdisttostrm.txt
  24. +0 −11 python/plugins/processing/algs/taudem/description/multi/dinfavalanche.txt
  25. +0 −11 python/plugins/processing/algs/taudem/description/multi/dinfconclimaccum.txt
  26. +0 −9 python/plugins/processing/algs/taudem/description/multi/dinfdecayaccum.txt
  27. +0 −6 python/plugins/processing/algs/taudem/description/multi/dinfflowdir.txt
  28. +0 −7 python/plugins/processing/algs/taudem/description/multi/dinfrevaccum.txt
  29. +0 −6 python/plugins/processing/algs/taudem/description/multi/dinfupdependence.txt
  30. +0 −6 python/plugins/processing/algs/taudem/description/multi/gagewatershed.txt
  31. +0 −7 python/plugins/processing/algs/taudem/description/multi/gagewatershed2.txt
  32. +0 −8 python/plugins/processing/algs/taudem/description/multi/moveoutletstostrm.txt
  33. +0 −5 python/plugins/processing/algs/taudem/description/multi/pitremove.txt
  34. +0 −6 python/plugins/processing/algs/taudem/description/multi/selectgtthreshold.txt
  35. +0 −6 python/plugins/processing/algs/taudem/description/multi/slopearearatio.txt
  36. +0 −7 python/plugins/processing/algs/taudem/description/multi/slopeavedown.txt
  37. +0 −14 python/plugins/processing/algs/taudem/description/multi/streamnet.txt
  38. +0 −7 python/plugins/processing/algs/taudem/description/multi/threshold.txt
  39. +0 −6 python/plugins/processing/algs/taudem/description/multi/twi.txt
  40. 0 python/plugins/processing/algs/taudem/description/{single → }/pitremove.txt
  41. 0 python/plugins/processing/algs/taudem/description/{single → }/selectgtthreshold.txt
  42. 0 python/plugins/processing/algs/taudem/description/{single → }/slopearearatio.txt
  43. 0 python/plugins/processing/algs/taudem/description/{single → }/slopeavedown.txt
  44. 0 python/plugins/processing/algs/taudem/description/{single → }/streamnet.txt
  45. 0 python/plugins/processing/algs/taudem/description/{single → }/threshold.txt
  46. 0 python/plugins/processing/algs/taudem/description/{single → }/twi.txt
  47. +0 −127 python/plugins/processing/algs/taudem/dinfdistdown_multi.py
  48. +0 −124 python/plugins/processing/algs/taudem/dinfdistup_multi.py
  49. +0 −122 python/plugins/processing/algs/taudem/dinftranslimaccum2_multi.py
  50. +0 −114 python/plugins/processing/algs/taudem/dinftranslimaccum_multi.py
  51. +0 −124 python/plugins/processing/algs/taudem/dropanalysis_multi.py
  52. +0 −114 python/plugins/processing/algs/taudem/gridnet_multi.py
  53. +0 −96 python/plugins/processing/algs/taudem/lengtharea_multi.py
  54. +0 −94 python/plugins/processing/algs/taudem/peukerdouglas_multi.py
  55. +0 −96 python/plugins/processing/algs/taudem/slopearea_multi.py
@@ -26,7 +26,7 @@
__revision__ = '$Format:%H$'

import os
from qgis.PyQt.QtCore import QCoreApplication

from qgis.PyQt.QtGui import QIcon

from processing.core.GeoAlgorithm import GeoAlgorithm
@@ -45,6 +45,9 @@

from .TauDEMUtils import TauDEMUtils

pluginPath = os.path.normpath(os.path.join(
os.path.split(os.path.dirname(__file__))[0], os.pardir))


class TauDEMAlgorithm(GeoAlgorithm):

@@ -59,34 +62,33 @@ def getCopy(self):
return newone

def getIcon(self):
return QIcon(os.path.dirname(__file__) + '/../../images/taudem.svg')
return QIcon(os.path.join(pluginPath, 'images', 'taudem.svg'))

def defineCharacteristicsFromFile(self):
lines = open(self.descriptionFile)
line = lines.readline().strip('\n').strip()
self.name = line
self.i18n_name = QCoreApplication.translate("TAUDEMAlgorithm", line)
line = lines.readline().strip('\n').strip()
self.cmdName = line
line = lines.readline().strip('\n').strip()
self.group = line
self.i18n_group = QCoreApplication.translate("TAUDEMAlgorithm", line)

line = lines.readline().strip('\n').strip()
while line != '':
try:
line = line.strip('\n').strip()
if line.startswith('Parameter'):
param = getParameterFromString(line)
self.addParameter(param)
else:
self.addOutput(getOutputFromString(line))
line = lines.readline().strip('\n').strip()
except Exception as e:
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
self.tr('Could not load TauDEM algorithm: %s\n%s' % (self.descriptionFile, line)))
raise e
lines.close()
with codecs.open(self.descriptionFile, 'utf-8') as f:
line = f.readline().strip('\n').strip()
self.name = line
self.i18n_name = self.tr(line)
line = f.readline().strip('\n').strip()
self.cmdName = line
line = f.readline().strip('\n').strip()
self.group = line
self.i18n_group = self.tr(line)

line = f.readline().strip('\n').strip()
while line != '':
try:
line = line.strip('\n').strip()
if line.startswith('Parameter'):
param = getParameterFromString(line)
self.addParameter(param)
else:
self.addOutput(getOutputFromString(line))
line = f.readline().strip('\n').strip()
except Exception as e:
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
self.tr('Could not load TauDEM algorithm: {}\n{}'.format(self.descriptionFile, line)))
raise e

def processAlgorithm(self, progress):
commands = []
@@ -57,6 +57,9 @@
from .dinftranslimaccum_multi import DinfTransLimAccumMulti
from .dinftranslimaccum2_multi import DinfTransLimAccum2Multi

pluginPath = os.path.normpath(os.path.join(
os.path.split(os.path.dirname(__file__))[0], os.pardir))


class TauDEMAlgorithmProvider(AlgorithmProvider):

@@ -71,7 +74,7 @@ def getName(self):
return 'taudem'

def getIcon(self):
return QIcon(os.path.dirname(__file__) + '/../../images/taudem.svg')
return QIcon(os.path.join(pluginPath, 'images', 'taudem.svg'))

def initializeSettings(self):
AlgorithmProvider.initializeSettings(self)
@@ -80,16 +83,6 @@ def initializeSettings(self):
TauDEMUtils.TAUDEM_FOLDER,
self.tr('TauDEM command line tools folder'),
TauDEMUtils.taudemPath(), valuetype=Setting.FOLDER))
ProcessingConfig.addSetting(Setting(self.getDescription(),
TauDEMUtils.TAUDEM_MULTIFILE_FOLDER,
self.tr('TauDEM multifile command line tools folder'),
TauDEMUtils.taudemMultifilePath(), valuetype=Setting.FOLDER))
ProcessingConfig.addSetting(Setting(self.getDescription(),
TauDEMUtils.TAUDEM_USE_SINGLEFILE,
self.tr('Enable singlefile TauDEM tools'), True))
ProcessingConfig.addSetting(Setting(self.getDescription(),
TauDEMUtils.TAUDEM_USE_MULTIFILE,
self.tr('Enable multifile TauDEM tools'), False))
ProcessingConfig.addSetting(Setting(self.getDescription(),
TauDEMUtils.MPIEXEC_FOLDER,
self.tr('MPICH2/OpenMPI bin directory'),
@@ -102,63 +95,36 @@ def unload(self):
AlgorithmProvider.unload(self)

ProcessingConfig.removeSetting(TauDEMUtils.TAUDEM_FOLDER)
ProcessingConfig.removeSetting(TauDEMUtils.TAUDEM_MULTIFILE_FOLDER)
ProcessingConfig.removeSetting(TauDEMUtils.TAUDEM_USE_SINGLEFILE)
ProcessingConfig.removeSetting(TauDEMUtils.TAUDEM_USE_MULTIFILE)
ProcessingConfig.removeSetting(TauDEMUtils.MPIEXEC_FOLDER)
ProcessingConfig.removeSetting(TauDEMUtils.MPI_PROCESSES)

def _loadAlgorithms(self):
self.algs = []
basePath = TauDEMUtils.taudemDescriptionPath()

if ProcessingConfig.getSetting(TauDEMUtils.TAUDEM_USE_SINGLEFILE):
folder = os.path.join(basePath, 'single')

for descriptionFile in os.listdir(folder):
if descriptionFile.endswith('txt'):
descriptionFile = os.path.join(folder, descriptionFile)
self._algFromDescription(descriptionFile)

self.algs.append(PeukerDouglas())
self.algs.append(SlopeArea())
self.algs.append(LengthArea())
self.algs.append(DropAnalysis())
self.algs.append(DinfDistDown())
self.algs.append(DinfDistUp())
self.algs.append(GridNet())
self.algs.append(DinfTransLimAccum())
self.algs.append(DinfTransLimAccum2())

if ProcessingConfig.getSetting(TauDEMUtils.TAUDEM_USE_MULTIFILE):
folder = os.path.join(basePath, 'multi')

for descriptionFile in os.listdir(folder):
if descriptionFile.endswith('txt'):
descriptionFile = os.path.join(folder, descriptionFile)
self._algFromDescription(descriptionFile, True)

self.algs.append(PeukerDouglasMulti())
self.algs.append(SlopeAreaMulti())
self.algs.append(LengthAreaMulti())
self.algs.append(DropAnalysisMulti())
self.algs.append(DinfDistDownMulti())
self.algs.append(DinfDistUpMulti())
self.algs.append(GridNetMulti())
self.algs.append(DinfTransLimAccumMulti())
self.algs.append(DinfTransLimAccum2Multi())
folder = TauDEMUtils.taudemDescriptionPath()

for descriptionFile in os.listdir(folder):
if descriptionFile.endswith('txt'):
descriptionFile = os.path.join(folder, descriptionFile)
self._algFromDescription(descriptionFile)

self.algs.append(PeukerDouglas())
self.algs.append(SlopeArea())
self.algs.append(LengthArea())
self.algs.append(DropAnalysis())
self.algs.append(DinfDistDown())
self.algs.append(DinfDistUp())
self.algs.append(GridNet())
self.algs.append(DinfTransLimAccum())
self.algs.append(DinfTransLimAccum2())

def _algFromDescription(self, descriptionFile, multifile=False):
try:
if multifile:
alg = TauDEMMultifileAlgorithm(descriptionFile)
else:
alg = TauDEMAlgorithm(descriptionFile)
alg = TauDEMAlgorithm(descriptionFile)
if alg.name.strip() != '':
self.algs.append(alg)
else:
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
self.tr('Could not open TauDEM algorithm: %s' % descriptionFile))
self.tr('Could not open TauDEM algorithm: {}'.format(descriptionFile)))
except Exception as e:
ProcessingLog.addToLog(ProcessingLog.LOG_ERROR,
self.tr('Could not open TauDEM algorithm %s:\n%s' % (descriptionFile, unicode(e))))
self.tr('Could not open TauDEM algorithm {}:\n{}'.format(descriptionFile, unicode(e))))

This file was deleted.

@@ -53,27 +53,11 @@ def taudemPath():

if isMac():
testfolder = os.path.join(QgsApplication.prefixPath(), 'bin')
if os.path.exists(os.path.join(testfolder, 'slopearea')):
if os.path.exists(os.path.join(testfolder, 'pitremove')):
folder = testfolder
else:
testfolder = '/usr/local/bin'
if os.path.exists(os.path.join(testfolder, 'slopearea')):
folder = testfolder
return folder

@staticmethod
def taudemMultifilePath():
folder = ProcessingConfig.getSetting(TauDEMUtils.TAUDEM_MULTIFILE_FOLDER)
if folder is None:
folder = ''

if isMac():
testfolder = os.path.join(QgsApplication.prefixPath(), 'bin')
if os.path.exists(os.path.join(testfolder, 'slopearea')):
folder = testfolder
else:
testfolder = '/usr/local/bin'
if os.path.exists(os.path.join(testfolder, 'slopearea')):
if os.path.exists(os.path.join(testfolder, 'pitremove')):
folder = testfolder
return folder

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 7866bda

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