def defineCharacteristics(self): self.name, self.i18n_name = self.trAlgorithm('Raster layer histogram') self.group, self.i18n_group = self.trAlgorithm('Graphics') self.addParameter(ParameterRaster(self.INPUT, self.tr('Input layer'))) self.addParameter(ParameterNumber(self.BINS, self.tr('Number of bins'), 2, None, 10)) self.addOutput(OutputHTML(self.PLOT, self.tr('Histogram'))) self.addOutput(OutputTable(self.TABLE, self.tr('Table')))
def defineCharacteristics(self): self.addParameter(ParameterVector(self.INPUT_LAYER, self.tr('Input vector layer'))) self.addParameter(ParameterTableField(self.VALUES_FIELD_NAME, self.tr('Field to calculate statistics on'), self.INPUT_LAYER, ParameterTableField.DATA_TYPE_NUMBER)) self.addParameter(ParameterTableField(self.CATEGORIES_FIELD_NAME, self.tr('Field with categories'), self.INPUT_LAYER, ParameterTableField.DATA_TYPE_ANY)) self.addOutput(OutputTable(self.OUTPUT, self.tr('Statistics by category')))
def defineCharacteristics(self): self.name, self.i18n_name = self.trAlgorithm('Relief (automatic colors)') self.group, self.i18n_group = self.trAlgorithm('Raster terrain analysis') self.addParameter(ParameterRaster(self.INPUT_LAYER, self.tr('Elevation layer'))) self.addParameter(ParameterNumber(self.Z_FACTOR, self.tr('Z factor'), 1.0, 999999.99, 1.0)) self.addOutput(OutputRaster(self.OUTPUT_LAYER, self.tr('Relief'))) self.addOutput(OutputTable(self.FREQUENCY_DISTRIBUTION, self.tr('Frequency distribution')))
def processOutputParameterToken(self, token): out = None if token.lower().strip().startswith('raster'): out = OutputRaster() elif token.lower().strip().startswith('vector'): out = OutputVector() elif token.lower().strip().startswith('table'): out = OutputTable() elif token.lower().strip().startswith('file'): out = OutputFile() return out
def defineCharacteristics(self): self.name, self.i18n_name = self.trAlgorithm('Statistics by categories') self.group, self.i18n_group = self.trAlgorithm('Vector table tools') self.addParameter(ParameterVector(self.INPUT_LAYER, self.tr('Input vector layer'), [ParameterVector.VECTOR_TYPE_ANY], False)) self.addParameter(ParameterTableField(self.VALUES_FIELD_NAME, self.tr('Field to calculate statistics on'), self.INPUT_LAYER, ParameterTableField.DATA_TYPE_NUMBER)) self.addParameter(ParameterTableField(self.CATEGORIES_FIELD_NAME, self.tr('Field with categories'), self.INPUT_LAYER, ParameterTableField.DATA_TYPE_ANY)) self.addOutput(OutputTable(self.OUTPUT, self.tr('Statistics by category')))
def defineCharacteristics(self): """Algorithme variable and parameters parameters""" CholeAlgorithm.defineCharacteristics(self) # The name/group that the user will see in the toolbox self.group = 'landscape metrics' self.i18n_group = self.tr('landscape metrics') self.name = 'grid' self.i18n_name = self.tr('grid') # === INPUT PARAMETERS === self.addParameter( ParameterRaster(name=self.INPUT_LAYER_ASC, description=self.tr('Input layer asc'))) self.addParameter( ParameterNumber(name=self.GRID_SIZES, description=self.tr('Grid size (pixels)'), default=3)) self.addParameter( ParameterNumber( name=self.MAXIMUM_RATE_MISSING_VALUES, description=self.tr('Maximum rate of mising values'), minValue=0, maxValue=100, default=100)) self.addParameter( ParameterString(name=self.METRICS, description=self.tr('Select metrics'))) # === OUTPUT PARAMETERS === self.addOutput( OutputFile(name=self.SAVE_PROPERTIES, description=self.tr('Properties file'), ext='properties')) self.addOutput( OutputTable(name=self.OUTPUT_CSV, description=self.tr('Output csv (*.csv)'))) self.addOutput( ASCOutputRaster(name=self.OUTPUT_ASC, description=self.tr('Output ascii (*.asc)')))
def defineCharacteristics(self): self.name = 'Statistics by categories' self.group = 'Vector table tools' self.addParameter( ParameterVector(self.INPUT_LAYER, 'Input vector layer', [ParameterVector.VECTOR_TYPE_ANY], False)) self.addParameter( ParameterTableField(self.VALUES_FIELD_NAME, 'Field to calculate statistics on', self.INPUT_LAYER, ParameterTableField.DATA_TYPE_NUMBER)) self.addParameter( ParameterTableField(self.CATEGORIES_FIELD_NAME, 'Field with categories', self.INPUT_LAYER, ParameterTableField.DATA_TYPE_ANY)) self.addOutput(OutputTable(self.OUTPUT, 'Statistics'))
def defineCharacteristics(self): self.name, self.i18n_name = self.trAlgorithm('Distance matrix') self.group, self.i18n_group = self.trAlgorithm('Vector analysis tools') self.addParameter(ParameterVector(self.INPUT_LAYER, self.tr('Input point layer'), [ParameterVector.VECTOR_TYPE_POINT])) self.addParameter(ParameterTableField(self.INPUT_FIELD, self.tr('Input unique ID field'), self.INPUT_LAYER, ParameterTableField.DATA_TYPE_ANY)) self.addParameter(ParameterVector(self.TARGET_LAYER, self.tr('Target point layer'), ParameterVector.VECTOR_TYPE_POINT)) self.addParameter(ParameterTableField(self.TARGET_FIELD, self.tr('Target unique ID field'), self.TARGET_LAYER, ParameterTableField.DATA_TYPE_ANY)) self.addParameter(ParameterSelection(self.MATRIX_TYPE, self.tr('Output matrix type'), self.MAT_TYPES, 0)) self.addParameter(ParameterNumber(self.NEAREST_POINTS, self.tr('Use only the nearest (k) target points'), 0, 9999, 0)) self.addOutput(OutputTable(self.DISTANCE_MATRIX, self.tr('Distance matrix')))
def defineCharacteristics(self): self.name, self.i18n_name = self.trAlgorithm('Canopy Maxima') self.group, self.i18n_group = self.trAlgorithm('Points') self.addParameter(ParameterFile( self.INPUT, self.tr('Input FUSION canopy height model'))) self.addParameter(ParameterFile( self.GROUND, self.tr('Input ground .dtm layer [optional]'))) self.addParameter(ParameterNumber( self.THRESHOLD, self.tr('Height threshold'), 0, None, 10.0)) # begin self.addParameter(ParameterNumber( self.PARAM_A, self.tr('Variable window size: parameter A'), 0, None, 2.51503)) self.addParameter(ParameterNumber( self.PARAM_C, self.tr('Parameter C'), 0, None, 0.00901)) self.addParameter(ParameterBoolean( self.SUMMARY, self.tr('Summary (tree height summary statistics)'), False)) # end self.addOutput(OutputTable( self.OUTPUT, self.tr('Output file with maxima'))) self.addAdvancedModifiers()
def defineCharacteristics(self): self.mat_types = [self.tr('Linear (N*k x 3) distance matrix'), self.tr('Standard (N x T) distance matrix'), self.tr('Summary distance matrix (mean, std. dev., min, max)')] self.addParameter(ParameterVector(self.INPUT_LAYER, self.tr('Input point layer'), [dataobjects.TYPE_VECTOR_POINT])) self.addParameter(ParameterTableField(self.INPUT_FIELD, self.tr('Input unique ID field'), self.INPUT_LAYER, ParameterTableField.DATA_TYPE_ANY)) self.addParameter(ParameterVector(self.TARGET_LAYER, self.tr('Target point layer'), dataobjects.TYPE_VECTOR_POINT)) self.addParameter(ParameterTableField(self.TARGET_FIELD, self.tr('Target unique ID field'), self.TARGET_LAYER, ParameterTableField.DATA_TYPE_ANY)) self.addParameter(ParameterSelection(self.MATRIX_TYPE, self.tr('Output matrix type'), self.mat_types, 0)) self.addParameter(ParameterNumber(self.NEAREST_POINTS, self.tr('Use only the nearest (k) target points'), 0, 9999, 0)) self.addOutput(OutputTable(self.DISTANCE_MATRIX, self.tr('Distance matrix')))
def defineCharacteristics(self): """Inputs and output description of the algorithm, along with some other properties. """ # The name that the user will see in the toolbox self.name = 'Coordinate format convertion' self.i18n_name = self.name # The branch of the toolbox under which the algorithm will appear self.group = 'Formatting' self.i18n_group = self.group # We add the input vector layer. It can have any kind of geometry # It is a mandatory (not optional) one, hence the False argument self.addParameter(ParameterTable(self.SOURCE_TABLE, 'Source table', optional=False)) self.addParameter(ParameterTableField(self.SOURCE_X_FIELD, "X (lon) or mgrs field ", parent=self.SOURCE_TABLE, optional=True)) self.addParameter(ParameterTableField(self.SOURCE_Y_FIELD, "Y (lat) or mgrs field", parent=self.SOURCE_TABLE, optional=True)) self.addParameter(ParameterSelection(self.SOURCE_FORMAT, "Source format", options=self.FORMAT_LIST, default=0)) self.addParameter(ParameterSelection(self.DESTINATION_FORMAT, "Destination format", options=self.FORMAT_LIST, default=0, optional=True)) self.addParameter(ParameterString(self.CUSTOM_FORMAT, "Custom coordinate format", default=self.CUSTOM_COORD_FORMAT, optional=True)) self.addParameter(ParameterString(self.OUTPUT_X_FIELD, "Destination X field", optional=True)) self.addParameter(ParameterString(self.OUTPUT_Y_FIELD, "Destination Y field", optional=True)) self.addParameter(ParameterString(self.OUTPUT_XY_FIELD, "Destination single XY field", optional=True)) self.addParameter(ParameterString(self.OUTPUT_COORDINATE_FORMAT, "Single field coord fromat", default=self.SINGLE_FIELD_COORD_FORMAT, optional=True)) # We add a table layer as output self.addOutput(OutputTable(self.OUTPUT_TABLE, 'Input table modified'))
def processOutputParameterToken(self, token): out = None if token.lower().strip().startswith('raster'): out = OutputRaster() elif token.lower().strip().startswith('vector'): out = OutputVector() elif token.lower().strip().startswith('table'): out = OutputTable() elif token.lower().strip().startswith('html'): out = OutputHTML() elif token.lower().strip().startswith('file'): out = OutputFile() subtokens = token.split(' ') if len(subtokens) > 2: out.ext = subtokens[2] elif token.lower().strip().startswith('directory'): out = OutputDirectory() elif token.lower().strip().startswith('number'): out = OutputNumber() elif token.lower().strip().startswith('string'): out = OutputString() return out
def defineCharacteristics(self): self.name, self.i18n_name = self.trAlgorithm('Relief') self.group, self.i18n_group = self.trAlgorithm( 'Raster terrain analysis') class ParameterReliefColors(Parameter): default_metadata = { 'widget_wrapper': 'processing.algs.qgis.ui.ReliefColorsWidget.ReliefColorsWidgetWrapper' } def __init__(self, name='', description='', parent=None, optional=True): Parameter.__init__(self, name, description, None, optional) self.parent = parent def setValue(self, value): if value is None: if not self.optional: return False self.value = None return True if value == '': if not self.optional: return False if isinstance(value, str): self.value = value if value != '' else None else: self.value = ParameterReliefColors.colorsToString(value) return True def getValueAsCommandLineParameter(self): return '"{}"'.format(self.value) def getAsScriptCode(self): param_type = '' param_type += 'relief colors ' return '##' + self.name + '=' + param_type @classmethod def fromScriptCode(self, line): isOptional, name, definition = _splitParameterOptions(line) descName = _createDescriptiveName(name) parent = definition.lower().strip()[len('relief colors') + 1:] return ParameterReliefColors(name, description, parent) @staticmethod def colorsToString(colors): s = '' for c in colors: s += '{:f}, {:f}, {:d}, {:d}, {:d};'.format( c[0], c[1], c[2], c[3], c[4]) return s[:-1] self.addParameter( ParameterRaster(self.INPUT_LAYER, self.tr('Elevation layer'))) self.addParameter( ParameterNumber(self.Z_FACTOR, self.tr('Z factor'), 1.0, 999999.99, 1.0)) self.addParameter( ParameterBoolean(self.AUTO_COLORS, self.tr('Generate relief classes automatically'), False)) self.addParameter( ParameterReliefColors(self.COLORS, self.tr('Relief colors'), self.INPUT_LAYER, True)) self.addOutput(OutputRaster(self.OUTPUT_LAYER, self.tr('Relief'))) self.addOutput( OutputTable(self.FREQUENCY_DISTRIBUTION, self.tr('Frequency distribution')))
def processParameterLine(self, line): param = None out = None line = line.replace('#', '') if line.lower().strip().startswith('showplots'): self.showPlots = True self.addOutput(OutputHTML(RAlgorithm.RPLOTS, 'R Plots')) return if line.lower().strip().startswith('dontuserasterpackage'): self.useRasterPackage = False return if line.lower().strip().startswith('passfilenames'): self.passFileNames = True return tokens = line.split('=') desc = self.createDescriptiveName(tokens[0]) if tokens[1].lower().strip() == 'group': self.group = tokens[0] return if tokens[1].lower().strip().startswith('raster'): param = ParameterRaster(tokens[0], desc, False) elif tokens[1].lower().strip() == 'vector': param = ParameterVector(tokens[0], desc, [ParameterVector.VECTOR_TYPE_ANY]) elif tokens[1].lower().strip() == 'vector point': param = ParameterVector(tokens[0], desc, [ParameterVector.VECTOR_TYPE_POINT]) elif tokens[1].lower().strip() == 'vector line': param = ParameterVector(tokens[0], desc, [ParameterVector.VECTOR_TYPE_LINE]) elif tokens[1].lower().strip() == 'vector polygon': param = ParameterVector(tokens[0], desc, [ParameterVector.VECTOR_TYPE_POLYGON]) elif tokens[1].lower().strip() == 'table': param = ParameterTable(tokens[0], desc, False) elif tokens[1].lower().strip().startswith('multiple raster'): param = ParameterMultipleInput(tokens[0], desc, ParameterMultipleInput.TYPE_RASTER) param.optional = False elif tokens[1].lower().strip() == 'multiple vector': param = ParameterMultipleInput( tokens[0], desc, ParameterMultipleInput.TYPE_VECTOR_ANY) param.optional = False elif tokens[1].lower().strip().startswith('selection'): options = tokens[1].strip()[len('selection'):].split(';') param = ParameterSelection(tokens[0], desc, options) elif tokens[1].lower().strip().startswith('boolean'): default = tokens[1].strip()[len('boolean') + 1:] param = ParameterBoolean(tokens[0], desc, default) elif tokens[1].lower().strip().startswith('number'): try: default = float(tokens[1].strip()[len('number') + 1:]) param = ParameterNumber(tokens[0], desc, default=default) except: raise WrongScriptException( self.tr( 'Could not load R script: %s.\n Problem with line %s' % (self.descriptionFile, line))) elif tokens[1].lower().strip().startswith('field'): field = tokens[1].strip()[len('field') + 1:] found = False for p in self.parameters: if p.name == field: found = True break if found: param = ParameterTableField(tokens[0], tokens[0], field) elif tokens[1].lower().strip() == 'extent': param = ParameterExtent(tokens[0], desc) elif tokens[1].lower().strip() == 'point': param = ParameterPoint(tokens[0], desc) elif tokens[1].lower().strip() == 'file': param = ParameterFile(tokens[0], desc, False) elif tokens[1].lower().strip() == 'folder': param = ParameterFile(tokens[0], desc, True) elif tokens[1].lower().strip().startswith('string'): default = tokens[1].strip()[len('string') + 1:] param = ParameterString(tokens[0], desc, default) elif tokens[1].lower().strip().startswith('longstring'): default = tokens[1].strip()[len('longstring') + 1:] param = ParameterString(tokens[0], desc, default, multiline=True) elif tokens[1].lower().strip().startswith('output raster'): out = OutputRaster() elif tokens[1].lower().strip().startswith('output vector'): out = OutputVector() elif tokens[1].lower().strip().startswith('output table'): out = OutputTable() elif tokens[1].lower().strip().startswith('output file'): out = OutputFile() if param is not None: self.addParameter(param) elif out is not None: out.name = tokens[0] out.description = tokens[0] self.addOutput(out) else: raise WrongScriptException( self.tr('Could not load R script: %s.\n Problem with line %s' % (self.descriptionFile, line)))
def defineCharacteristics(self): """Algorithme variable and parameters parameters""" CholeAlgorithm.defineCharacteristics(self) # The name/group that the user will see in the toolbox self.group = 'landscape metrics' self.i18n_group = self.tr('landscape metrics') self.name = 'sliding' self.i18n_name = self.tr('sliding') # === INPUT PARAMETERS === self.addParameter(ParameterRaster( name=self.INPUT_LAYER_ASC, description=self.tr('Input layer asc'))) self.addParameter(ParameterSelection( name=self.WINDOW_SHAPE, description=self.tr('Window shape'), options = ';'.join(self.types_of_shape))) self.addParameter(ParameterFile( name=self.FRICTION_FILE, description=self.tr('Friction file'))) self.addParameter(ParameterNumber( name=self.WINDOW_SIZES, description=self.tr('Window size (pixels)'), default=3)) self.addParameter(ParameterNumber( name=self.DELTA_DISPLACEMENT, description=self.tr('Delta od displacement (pixels)'), default=1)) self.addParameter(ParameterBoolean( name=self.INTERPOLATE_VALUES_BOOL, description=self.tr('Interpolate Values'), default=False)) self.addParameter(ParameterString( name=self.FILTER, description=self.tr('Filters - Analyse only (optional)'), default='', optional=True)) self.addParameter(ParameterString( name=self.UNFILTER, default='', description=self.tr('Filters - Do not analyse (optional)'), optional=True)) self.addParameter(ParameterNumber( name=self.MAXIMUM_RATE_MISSING_VALUES, description=self.tr('Maximum rate of mising values'), minValue=0, maxValue=100, default=100)) self.addParameter(ParameterString( name=self.METRICS, description=self.tr('Select metrics'))) # === OUTPUT PARAMETERS === self.addOutput(OutputFile( name=self.SAVE_PROPERTIES, description=self.tr('Properties file'), ext='properties')) self.addOutput(OutputTable( name=self.OUTPUT_CSV, description=self.tr('Output csv (*.csv)'))) self.addOutput(ASCOutputRaster( name=self.OUTPUT_ASC, description=self.tr('Output ascii (*.asc)')))
def processParameterLine(self, line): param = None out = None line = line.replace('#', '') # If the line is in the format of the text description files for # normal algorithms, then process it using parameter and output # factories if '|' in line: self.processDescriptionParameterLine(line) return if line == "nomodeler": self.showInModeler = False return tokens = line.split('=', 1) desc = self.createDescriptiveName(tokens[0]) if tokens[1].lower().strip() == 'group': self.group = tokens[0] return if tokens[1].lower().strip() == 'name': self.name = tokens[0] return if tokens[1].lower().strip() == 'raster': param = ParameterRaster(tokens[0], desc, False) elif tokens[1].lower().strip() == 'vector': param = ParameterVector(tokens[0], desc, [ParameterVector.VECTOR_TYPE_ANY]) elif tokens[1].lower().strip() == 'vector point': param = ParameterVector(tokens[0], desc, [ParameterVector.VECTOR_TYPE_POINT]) elif tokens[1].lower().strip() == 'vector line': param = ParameterVector(tokens[0], desc, [ParameterVector.VECTOR_TYPE_LINE]) elif tokens[1].lower().strip() == 'vector polygon': param = ParameterVector(tokens[0], desc, [ParameterVector.VECTOR_TYPE_POLYGON]) elif tokens[1].lower().strip() == 'table': param = ParameterTable(tokens[0], desc, False) elif tokens[1].lower().strip() == 'multiple raster': param = ParameterMultipleInput(tokens[0], desc, ParameterMultipleInput.TYPE_RASTER) param.optional = False elif tokens[1].lower().strip() == 'multiple vector': param = ParameterMultipleInput( tokens[0], desc, ParameterMultipleInput.TYPE_VECTOR_ANY) param.optional = False elif tokens[1].lower().strip().startswith('selection'): options = tokens[1].strip()[len('selection '):].split(';') param = ParameterSelection(tokens[0], desc, options) elif tokens[1].lower().strip().startswith('boolean'): default = tokens[1].strip()[len('boolean') + 1:] param = ParameterBoolean(tokens[0], desc, default) elif tokens[1].lower().strip() == 'extent': param = ParameterExtent(tokens[0], desc) elif tokens[1].lower().strip() == 'file': param = ParameterFile(tokens[0], desc, False) elif tokens[1].lower().strip() == 'folder': param = ParameterFile(tokens[0], desc, True) elif tokens[1].lower().strip().startswith('number'): default = tokens[1].strip()[len('number') + 1:] param = ParameterNumber(tokens[0], desc, default=default) elif tokens[1].lower().strip().startswith('field'): field = tokens[1].strip()[len('field') + 1:] found = False for p in self.parameters: if p.name == field: found = True break if found: param = ParameterTableField(tokens[0], desc, field) elif tokens[1].lower().strip().startswith('string'): default = tokens[1].strip()[len('string') + 1:] param = ParameterString(tokens[0], desc, default) elif tokens[1].lower().strip().startswith('longstring'): default = tokens[1].strip()[len('longstring') + 1:] param = ParameterString(tokens[0], desc, default, multiline=True) elif tokens[1].lower().strip().startswith('crs'): default = tokens[1].strip()[len('crs') + 1:] if not default: default = 'EPSG:4326' param = ParameterCrs(tokens[0], desc, default) elif tokens[1].lower().strip().startswith('output raster'): out = OutputRaster() elif tokens[1].lower().strip().startswith('output vector'): out = OutputVector() elif tokens[1].lower().strip().startswith('output table'): out = OutputTable() elif tokens[1].lower().strip().startswith('output html'): out = OutputHTML() elif tokens[1].lower().strip().startswith('output file'): out = OutputFile() subtokens = tokens[1].split(' ') if len(subtokens) > 2: out.ext = subtokens[2] elif tokens[1].lower().strip().startswith('output directory'): out = OutputDirectory() elif tokens[1].lower().strip().startswith('output number'): out = OutputNumber() elif tokens[1].lower().strip().startswith('output string'): out = OutputString() if param is not None: self.addParameter(param) elif out is not None: out.name = tokens[0] out.description = desc self.addOutput(out) else: raise WrongScriptException( self.tr('Could not load script: %s.\n' 'Problem with line %d', 'ScriptAlgorithm') % (self.descriptionFile or '', line))
def defineCharacteristics(self): self.name = 'Simulate flow in storm water conveyance systems' self.group = 'Simulation' self.addParameter( ParameterString(self.TITLE, 'Title', 'Swmm Simulation')) self.addParameter( ParameterTable(self.OPTIONS, 'Analysis options', True)) self.addParameter( ParameterTable(self.REPORT, 'Output reporting instructions', True)) self.addParameter( ParameterTable(self.FILES, 'Interface file options', True)) self.addParameter( ParameterTable(self.RAINGAGES, 'Rain gage information', True)) self.addParameter( ParameterTable( self.HYDROGRAPHS, 'Unit hydrograph data used to construct RDII inflows', True)) self.addParameter( ParameterTable(self.EVAPORATION, 'Evaporation data', True)) self.addParameter( ParameterTable(self.TEMPERATURE, 'Air temperature and snow melt data', True)) self.addParameter( ParameterVector(self.SUBCATCHMENTS, 'Basic subcatchment information', [ParameterVector.VECTOR_TYPE_POLYGON], True)) self.addParameter( ParameterTable(self.SUBAREAS, 'Subcatchment impervious/pervious sub-area data', True)) self.addParameter( ParameterTable(self.INFILTRATION, 'Subcatchment infiltration parameters', True)) self.addParameter( ParameterTable(self.LID_CONTROLS, 'Low impact development control information', True)) self.addParameter( ParameterTable(self.LID_USAGE, 'Assignment of LID controls to subcatchments', True)) self.addParameter( ParameterTable(self.AQUIFERS, 'Groundwater aquifer parameters', True)) self.addParameter( ParameterTable(self.GROUNDWATER, 'Subcatchment groundwater parameters', True)) self.addParameter( ParameterTable(self.SNOWPACKS, 'Subcatchment snow pack parameters', True)) self.addParameter( ParameterVector(self.JUNCTIONS, 'Junction node information', [ParameterVector.VECTOR_TYPE_POINT], True)) self.addParameter( ParameterTable(self.OUTFALLS, 'Outfall node information', True)) self.addParameter( ParameterVector(self.DIVIDERS, 'Flow divider node information', [ParameterVector.VECTOR_TYPE_POINT], True)) self.addParameter( ParameterVector(self.STORAGE, 'Storage node information', [ParameterVector.VECTOR_TYPE_POINT], True)) self.addParameter( ParameterVector(self.CONDUITS, 'Conduit link information', [ParameterVector.VECTOR_TYPE_LINE], True)) self.addParameter( ParameterVector(self.PUMPS, 'Pump link information', [ParameterVector.VECTOR_TYPE_POINT], True)) self.addParameter( ParameterVector(self.ORIFICES, 'Orifice link information', [ParameterVector.VECTOR_TYPE_POINT], True)) self.addParameter( ParameterVector(self.WEIRS, 'Weir link information', [ParameterVector.VECTOR_TYPE_POINT], True)) self.addParameter( ParameterVector(self.OUTLETS, 'Outlet link information', [ParameterVector.VECTOR_TYPE_POINT], True)) self.addParameter( ParameterTable( self.XSECTIONS, 'Conduit, orifice, and weir cross-section geometry', True)) self.addParameter( ParameterTable( self.TRANSECTS, 'Transect geometry for conduits with irregular cross-sections', True)) self.addParameter( ParameterTable(self.LOSSES, 'Conduit entrance/exit losses and flap valves', True)) self.addParameter( ParameterTable(self.CONTROLS, 'Rules that control pump and regulator operation', True)) self.addParameter( ParameterTable(self.POLLUTANTS, 'Pollutant information', True)) self.addParameter( ParameterTable(self.LANDUSES, 'Land use categories', True)) self.addParameter( ParameterTable(self.COVERAGES, 'Assignment of land uses to subcatchments', True)) self.addParameter( ParameterTable(self.BUILDUP, 'Buildup functions for pollutants and land uses', True)) self.addParameter( ParameterTable(self.WASHOFF, 'Washoff functions for pollutants and land uses', True)) self.addParameter( ParameterTable( self.TREATMENT, 'Pollutant removal functions at conveyance system nodes', True)) self.addParameter( ParameterTable(self.INFLOWS, 'External hydrograph/pollutograph inflow at nodes', True)) self.addParameter( ParameterTable(self.DWF, 'Baseline dry weather sanitary inflow at nodes', True)) self.addParameter( ParameterTable(self.PATTERNS, 'Periodic variation in dry weather inflow', True)) self.addParameter( ParameterTable(self.RDII, 'Rainfall-dependent I/I information at nodes', True)) self.addParameter( ParameterTable(self.LOADINGS, 'Initial pollutant loads on subcatchments', True)) self.addParameter( ParameterTable(self.CURVES, 'x-y tabular data referenced in other sections', True)) self.addParameter( ParameterTable(self.TIMESERIES, 'Time series data referenced in other sections', True)) self.addOutput(OutputVector(self.NODE_OUTPUT, 'Node output layer')) self.addOutput(OutputTable(self.NODE_TABLE_OUTPUT, 'Node output table')) self.addOutput(OutputVector(self.LINK_OUTPUT, 'Link output layer')) pass
def defineCharacteristics(self): """Algorithme variable and parameters parameters""" CholeAlgorithm.defineCharacteristics(self) # The name/group that the user will see in the toolbox self.group = 'landscape metrics' self.i18n_group = self.tr('landscape metrics') self.name = 'selected' self.i18n_name = self.tr('selected') # === INPUT PARAMETERS === self.addParameter(ParameterRaster( name=self.INPUT_LAYER_ASC, description=self.tr('Input layer asc'))) self.addParameter(ParameterSelection( name=self.WINDOW_SHAPE, description=self.tr('Window shape'), options = ';'.join(self.types_of_shape))) self.addParameter(ParameterFile( name=self.FRICTION_FILE, description=self.tr('Friction file'))) self.addParameter(ParameterNumber( name=self.WINDOW_SIZES, description=self.tr('Windows sizes (pixels)'), default=3)) self.addParameter(ParameterSelection( name=self.PIXELS_POINTS_SELECT, description=self.tr('Pixels/points selection'), options = ';'.join(self.types_of_pixel_point_select))) self.addParameter(ParameterFile( name=self.PIXELS_FILE, description=self.tr('Pixels file'))) self.addParameter(ParameterFile( name=self.POINTS_FILE, description=self.tr('Points file'))) self.addParameter(ParameterNumber( name=self.MAXIMUM_RATE_MISSING_VALUES, description=self.tr('Maximum rate of mising values'), minValue=0, maxValue=100, default=100)) self.addParameter(ParameterString( name=self.METRICS, description=self.tr('Select metrics'))) # === OUTPUT PARAMETERS === self.addOutput(OutputFile( name=self.SAVE_PROPERTIES, description=self.tr('Properties file'), ext='properties')) self.addOutput(OutputTable( name=self.OUTPUT_CSV, description=self.tr('Output csv (*.csv)'))) self.addOutput(ASCOutputRaster( name=self.OUTPUT_ASC, description=self.tr('Output ascii (*.asc)')))