Skip to content
Permalink
Browse files

Update CanopyModel.py

fixed some syntax errors and added an output option (ASCII)
  • Loading branch information
spono committed Nov 30, 2015
1 parent 57eb409 commit ec9f086222bc8a514fc00e1c600623c8e973f830
Showing with 14 additions and 14 deletions.
  1. +14 −14 python/plugins/processing/algs/lidar/fusion/CanopyModel.py
@@ -50,7 +50,7 @@ class CanopyModel(FusionAlgorithm):
SMOOTH = 'SMOOTH'
SLOPE = 'SLOPE'
CLASS = 'CLASS'
ADVANCED_MODIFIERS = 'ADVANCED_MODIFIERS'
ASCII = 'ASCII'

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('Canopy Model')
@@ -77,18 +77,17 @@ def defineCharacteristics(self):
self.SMOOTH, self.tr('Smooth'), '', False, True)
smooth.isAdvanced = True
self.addParameter(smooth)
slope = ParameterString(
self.SLOPE, self.tr('Slope'), '', False, True)
slope.isAdvanced = True
self.addParameter(slope)
class_var = ParameterString(
self.CLASS, self.tr('Class'), '', False, True)
class_var.isAdvanced = True
self.addParameter(class_var)
advance_modifiers = ParameterString(
self.ADVANCED_MODIFIERS, self.tr('Additional modifiers'), '', False, True)
advance_modifiers.isAdvanced = True
self.addParameter(advance_modifiers)
slope = ParameterBoolean(
self.SLOPE, self.tr('Calculate slope'), False)
slope.isAdvanced = True
self.addParameter(slope)
self.addParameter(ParameterBoolean(
self.ASCII, self.tr('Add an ASCII output'), False))
self.addAdvancedModifiers()

def processAlgorithm(self, progress):
commands = [os.path.join(FusionUtils.FusionPath(), 'CanopyModel.exe')]
@@ -103,14 +102,15 @@ def processAlgorithm(self, progress):
if unicode(smooth).strip():
commands.append('/smooth:' + unicode(smooth))
slope = self.getParameterValue(self.SLOPE)
if unicode(slope).strip():
commands.append('/slope:' + unicode(slope))
if slope:
commands.append('/slope')
class_var = self.getParameterValue(self.CLASS)
if unicode(class_var).strip():
commands.append('/class:' + unicode(class_var))
advance_modifiers = unicode(self.getParameterValue(self.ADVANCED_MODIFIERS)).strip()
if advance_modifiers:
commands.append(advance_modifiers)
ascii = self.getParameterValue(self.ASCII)
if ascii:
commands.append('/ascii')
self.addAdvancedModifiersToCommand(commands)
commands.append(self.getOutputValue(self.OUTPUT_DTM))
commands.append(unicode(self.getParameterValue(self.CELLSIZE)))
commands.append(self.UNITS[self.getParameterValue(self.XYUNITS)][0])

0 comments on commit ec9f086

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