Skip to content

Commit

Permalink
Massive conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
Médéric RIBREUX committed Nov 4, 2017
1 parent 56b963e commit 4b8b6a0
Show file tree
Hide file tree
Showing 167 changed files with 989 additions and 775 deletions.
516 changes: 263 additions & 253 deletions python/plugins/processing/algs/grass7/Grass7Algorithm.py

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions python/plugins/processing/algs/grass7/Grass7Utils.py
Expand Up @@ -52,6 +52,7 @@ class Grass7Utils(object):
GRASS_LOG_COMMANDS = 'GRASS7_LOG_COMMANDS'
GRASS_LOG_CONSOLE = 'GRASS7_LOG_CONSOLE'
GRASS_HELP_PATH = 'GRASS_HELP_PATH'
GRASS_USE_VEXTERNAL = 'GRASS_USE_VEXTERNAL'

sessionRunning = False
sessionLayers = {}
Expand Down Expand Up @@ -118,11 +119,11 @@ def grassPath():
# Grab folder from Processing configuration
if not isWindows() and not isMac():
return ''

folder = ProcessingConfig.getSetting(Grass7Utils.GRASS_FOLDER) or ''
if not os.path.exists(folder):
folder = None

# If no folder is declared, search for it
if folder is None:
# Under MSWindows, we use OSGEO4W
Expand Down
243 changes: 231 additions & 12 deletions python/plugins/processing/algs/grass7/TODO.md
Expand Up @@ -7,21 +7,240 @@ QGIS3 Processing Port
* print -> print(
* unicode -> str
* dict iteritems
* Replace all parameters by QgsProcessingParameters.
* Re-enable GRASS algorithm by default.
* TODO Replace all parameters by QgsProcessingParameters.
* DONE Review all ParameterFile
* TODO We need Null QgsParameterNumber!
* TODO We need NULL QgsParameterPoint!
* TODO We need a QgsParameterList!
* TODO Review all OutputDirectory.
* DONE Review all OutputFile
* DONE Replace by QgsProcessingParameterFileDestination
* DONE QgsProcessingParameterFileDestination should use the file filter in Dialog.
Replace fileOut with fileDestination in gui/ParametersUtils.py
* DONE Re-enable GRASS algorithm by default.
* Add GRASS 7.2 new algorithms.
* TODO Review all algorithm parameters.
MOD r.basins.fill
OK r.blend
OK r.buffer
OK r.buffer.lowmem
OK r.carve
OK r.category
MOD r.circle
MOD r.clump
OK r.coin
TODO r.colors OutputDirectory
OK r.colors.out
OK r.colors.stddev
OK r.composite
OK r.compress
MOD r.contour
MOD r.cost
OK r.covar
OK r.cross
r.describe
r.distance
r.drain
r.external
r.external.out
r.fill.dir
r.fillnulls
r.flow
r.grow.distance
r.grow
r.gwflow
r.his
r.horizon
r.import
r.in.ascii
r.in.aster
r.in.bin
r.in.gdal
r.in.gridatb
r.in.lidar
r.in.mat
r.in.png
r.in.poly
r.in.srtm
r.in.wms
r.in.xyz
r.info
r.kappa
r.lake
r.latlong
r.li.cwed
r.li.daemon
r.li.dominance
r.li.edgedensity
r.li
r.li.mpa
r.li.mps
r.li.padcv
r.li.padrange
r.li.padsd
r.li.patchdensity
r.li.patchnum
r.li.pielou
r.li.renyi
r.li.richness
r.li.shannon
r.li.shape
r.li.simpson
r.mapcalc
r.mask
r.mfilter
r.mode
r.neighbors
r.null
r.out.ascii
r.out.bin
r.out.gdal
r.out.gridatb
r.out.mat
r.out.mpeg
r.out.png
r.out.pov
r.out.ppm
r.out.ppm3
r.out.vrml
r.out.vtk
r.out.xyz
r.pack
r.param.scale
r.patch
r.plane
r.profile
r.proj
r.quant
r.quantile
r.random.cells
r.random
r.random.surface
r.reclass.area
r.reclass
r.recode
r.region
r.regression.line
r.regression.multi
r.relief
r.report
r.resamp.bspline
r.resamp.filter
r.resamp.interp
r.resamp.rst
r.resamp.stats
r.resample
r.rescale.eq
r.rescale
r.rgb
r.ros
r.series.accumulate
r.series
r.series.interp
r.shade
r.sim.sediment
r.sim.water
r.slope.aspect
r.solute.transport
r.spread
r.spreadpath
r.statistics
r.stats
r.stats.quantile
r.stats.zonal
r.stream.extract
r.sun
r.sunhours
r.sunmask
r.support
r.support.stats
r.surf.area
r.surf.contour
r.surf.fractal
r.surf.gauss
r.surf.idw
r.surf.random
r.terraflow
r.texture
r.thin
r.tile
r.tileset
r.timestamp
r.to.rast3
r.to.rast3elev
r.to.vect
r.topidx
r.topmodel
r.transect
r.univar
r.unpack
r.uslek
r.usler
r.viewshed
r.volume
r.walk
r.water.outlet
r.watershed
r.what.color
r.what

* Improve unit tests.
* Use some raster/vector layers with spacename into their path.
* Better support for files output that are not HTML.
* Use prepareAlgorithm for algorithm preparation.
* Opens HTML files in Viewer.
* Support ParameterTable.
* Remove specific algorithms code in Grass7Algorithm.py (move them in ext).
* Convert all ext scripts.
* Support OutputFolder.
* Support multiple output raster formats.
* Support multiple output vector formats.
* Support multiple bands input rasters.
* DONE Better support for files output that are HTML.
* DONE All html output files will be report outputs.
* DONE All html output will come as stdout files by default.
* DONE OutputHtml must not be converted to OutputLayerDefinition.
* DONE Convert false HTML files to real HTML files.
* DONE Opens HTML files in Viewer.
* TODO Use prepareAlgorithm for algorithm preparation.
* TODO Support ParameterTable.
* DONE Remove specific algorithms code in Grass7Algorithm.py (move them in ext).
* TODO Convert all ext scripts.
* TODO Force projection in description file?
* r_rgb.py
* r_blend_combine.py
* r_blend_rgb.py
* r_drain.py
* r_horizon.py
* r_mask.py
* r_mask_vect.py
* r_mask_rast.py
* r_null.py
* r_statistics.py
* v_voronoi.py
* v_build_polylines.py => TO delete.
* v_in_geonames.py.
* v_sample.py.
* v_to_3d.py.
* v_pack.py.
* v_what_vect.py => TO delete.
* v_what_rast_points.py.
* v_what_rast_centroids.py.
* v_vect_stats.py
* v_rast_stats.py
* v_net.py
* v_net_alloc.py
* v_net_allpairs.py
* v_net_arcs.py
* v_net_articulation.py
* v_net_connect.py
* v_net_connectivity.py
* v_net_flow.py
* v_net_iso.py
* v_net_nodes.py
* v_net_path.py
* v_net_steiner.py
* v_net_visibility.py

* TODO Support OutputFolder.
* TODO Support multiple output raster formats.
* TODO Support multiple output vector formats.
* TODO Support multiple input vector formats
* DONE create a general inputVectorLayer method.
* TODO Some formats can't be correctly used by v.external:
* GML.
* TODO Build a workaround for those formats (use v.in.ogr).
* DONE Support multiple bands input rasters.
* Review all the methods of QgsProcessingAlgorithm.
* Make tests under MS-Windows 7 for Utf-8 support.

Expand Down
Expand Up @@ -5,7 +5,7 @@ QgsProcessingParameterRasterLayer|input|Name of input raster map|None|False
QgsProcessingParameterRange|range|Input imagery range [0,255]|0,255|True
QgsProcessingParameterRasterLayer|elevation|Input altitude raster map in m (optional)|None|True
QgsProcessingParameterRasterLayer|visibility|Input visibility raster map in km (optional)|None|True
QgsProcessingParameterFile|parameters|Name of input text file|False|False
QgsProcessingParameterFile|parameters|Name of input text file|0|txt|None|False
QgsProcessingParameterRange|rescale|Rescale output raster map [0,255]|0,255|True
QgsProcessingParameterRasterDestination|output|Atmospheric correction
*QgsProcessingParameterBoolean|-i|Output raster map as integer|False
Expand Down
Expand Up @@ -2,5 +2,5 @@ i.cca
Canonical components analysis (CCA) program for image processing.
Imagery (i.*)
QgsProcessingParameterMultipleLayers|input|Input rasters (2 to 8)|3|None|False
QgsProcessingParameterFile|signature|File containing spectral signatures|False|False
QgsProcessingParameterFile|signature|File containing spectral signatures|0|txt|None|False
OutputDirectory|output|Output Directory
Expand Up @@ -3,11 +3,11 @@ Generates spectral signatures for land cover types in an image using a clusterin
Imagery (i.*)
QgsProcessingParameterMultipleLayers|input|Input rasters|3|None|False
QgsProcessingParameterNumber|classes|Initial number of classes (1-255)|QgsProcessingParameterNumber.Integer|1|True|1|255
QgsProcessingParameterFile|seed|Name of file containing initial signatures|False|True
QgsProcessingParameterFile|seed|Name of file containing initial signatures|0|txt|None|True
QgsProcessingParameterString|sample|Sampling intervals (by row and col)|None|False|True
QgsProcessingParameterNumber|iterations|Maximum number of iterations|QgsProcessingParameterNumber.Integer|30|True|1|None
QgsProcessingParameterNumber|convergence|Percent convergence|QgsProcessingParameterNumber.Double|98.0|True|0.0|100.0
QgsProcessingParameterNumber|separation|Cluster separation|QgsProcessingParameterNumber.Double|0.0|True|0.0|None
QgsProcessingParameterNumber|min_size|Minimum number of pixels in a class|QgsProcessingParameterNumber.Integer|17|True|1|None
OutputFile|signaturefile|Signature File
OutputFile|reportfile|Final Report File
QgsProcessingParameterFileDestination|signaturefile|Signature File|Txt files (*.txt)|None|False
QgsProcessingParameterFileDestination|reportfile|Final Report File|Txt files (*.txt)|None|False
Expand Up @@ -3,5 +3,5 @@ Generates statistics for i.maxlik from raster map.
Imagery (i.*)
QgsProcessingParameterRasterLayer|trainingmap|Ground truth training map|None|False
QgsProcessingParameterMultipleLayers|input|Input rasters|3|None|False
OutputFile|signaturefile|Signature File
QgsProcessingParameterFileDestination|signaturefile|Signature File|Txt files (*.txt)|None|False

Expand Up @@ -4,5 +4,5 @@ Imagery (i.*)
QgsProcessingParameterRasterLayer|trainingmap|Ground truth training map|None|False
QgsProcessingParameterMultipleLayers|input|Input rasters|3|None|False
QgsProcessingParameterNumber|maxsig|Maximum number of sub-signatures in any class|QgsProcessingParameterNumber.Integer|5|True|0|None
OutputFile|signaturefile|Signature File
QgsProcessingParameterFileDestination|signaturefile|Signature File|Txt files (*.txt)|None|False

Expand Up @@ -2,7 +2,7 @@ i.landsat.toar
Calculates top-of-atmosphere radiance or reflectance and temperature for Landsat MSS/TM/ETM+/OLI
Imagery (i.*)
QgsProcessingParameterMultipleLayers|rasters|Landsat input rasters|3|None|False
QgsProcessingParameterFile|metfile|Name of Landsat metadata file (.met or MTL.txt)|False|True
QgsProcessingParameterFile|metfile|Name of Landsat metadata file (.met or MTL.txt)|0|met|None|True
QgsProcessingParameterEnum|sensor|Spacecraft sensor|mss1;mss2;mss3;mss4;mss5;tm4;tm5;tm7;oli8|False|7
QgsProcessingParameterEnum|method|Atmospheric correction method|uncorrected;dos1;dos2;dos2b;dos3;dos4|False|0
QgsProcessingParameterString|date|Image acquisition date (yyyy-mm-dd)|None|False|True
Expand Down
Expand Up @@ -2,6 +2,6 @@ i.maxlik
Classifies the cell spectral reflectances in imagery data.
Imagery (i.*)
QgsProcessingParameterMultipleLayers|input|Input rasters|3|None|False
QgsProcessingParameterFile|signaturefile|Name of input file containing signatures|False|False
QgsProcessingParameterFile|signaturefile|Name of input file containing signatures|0|txt|None|False
QgsProcessingParameterRasterDestination|output|Classification
QgsProcessingParameterRasterDestination|reject|Reject Threshold
Expand Up @@ -4,5 +4,5 @@ Imagery (i.*)
QgsProcessingParameterMultipleLayers|input|Name of input raster map(s)|3|None|False
*QgsProcessingParameterBoolean|-g|Print in shell script style|False
*QgsProcessingParameterBoolean|-s|Process bands serially (default: run in parallel)|False
OutputFile|output|OIF File
QgsProcessingParameterFileDestination|output|OIF File|Txt files (*.txt)|None|False

Expand Up @@ -2,7 +2,7 @@ i.rectify
Rectifies an image by computing a coordinate transformation for each pixel in the image based on the control points.
Imagery (i.*)
QgsProcessingParameterMultipleLayers|rasters|Name of raster maps to rectify|3|None|False
QgsProcessingParameterFile|gcp|Ground Control Points file|False|False
QgsProcessingParameterFile|gcp|Ground Control Points file|0|txt|None|False
QgsProcessingParameterEnum|order|Rectification polynomial order|1;2;3|False|0
QgsProcessingParameterNumber|resolution|Target resolution|QgsProcessingParameterNumber.Double|None|True|None|None
QgsProcessingParameterNumber|memory|Amount of memory to use in MB|QgsProcessingParameterNumber.Integer|300|True|1|None
Expand Down
Expand Up @@ -2,7 +2,7 @@ i.smap
Performs contextual image classification using sequential maximum a posteriori (SMAP) estimation.
Imagery (i.*)
QgsProcessingParameterMultipleLayers|input|Input rasters|3|None|False
QgsProcessingParameterFile|signaturefile|Name of input file containing signatures|False|False
QgsProcessingParameterFile|signaturefile|Name of input file containing signatures|0|txt|None|False
QgsProcessingParameterNumber|blocksize|Size of submatrix to process at one time|QgsProcessingParameterNumber.Integer|1024|True|1|None
*QgsProcessingParameterBoolean|-m|Use maximum likelihood estimation (instead of smap)|False
QgsProcessingParameterRasterDestination|output|Classification
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/grass7/description/m.cogo.txt
@@ -1,8 +1,8 @@
m.cogo
A simple utility for converting bearing and distance measurements to coordinates and vice versa. It assumes a Cartesian coordinate system
Miscellaneous (m.*)
QgsProcessingParameterFile|input|Name of input file|False
OutputFile|output|Output text file
QgsProcessingParameterFile|input|Name of input file|0|txt|None|False
QgsProcessingParameterFileDestination|output|Output text file|Txt files (*.txt)|None|False
QgsProcessingParameterPoint|coordinates|Starting coordinate pair|0.0,0.0
*QgsProcessingParameterBoolean|-l|Lines are labelled|False
*QgsProcessingParameterBoolean|-q|Suppress warnings|False
Expand Down
Expand Up @@ -5,4 +5,4 @@ QgsProcessingParameterRasterLayer|map|Name of raster map|None|False
QgsProcessingParameterString|cats|Category values (for Integer rasters). Example: 1,3,7-9,13|None|False|True
QgsProcessingParameterString|values|Comma separated value list (for float rasters). Example: 1.4,3.8,13|None|False|True
QgsProcessingParameterString|separator|Field separator (Special characters: pipe, comma, space, tab, newline)|tab|False|True
OutputFile|output|Category
QgsProcessingParameterFileDestination|output|Category|Txt files (*.txt)|None|False
Expand Up @@ -3,7 +3,7 @@ Manages category values and labels associated with user-specified raster map lay
Raster (r.*)
QgsProcessingParameterRasterLayer|map|Name of raster map|None|False
QgsProcessingParameterString|separator|Field separator (Special characters: pipe, comma, space, tab, newline)|tab|False|True
QgsProcessingParameterFile|rules|File containing category label rules|False|True
QgsProcessingParameterFile|rules|File containing category label rules|0|txt|None|True
QgsProcessingParameterString|txtrules|Inline category label rules|None|True|True
QgsProcessingParameterRasterLayer|raster|Raster map from which to copy category table|None|True
*QgsProcessingParameterString|format|Default label or format string for dynamic labeling. Used when no explicit label exists for the category|None|False|True
Expand Down
Expand Up @@ -4,6 +4,6 @@ Raster (r.*)
QgsProcessingParameterPoint|coordinates|The coordinate of the center (east,north)|0,0
QgsProcessingParameterNumber|min|Minimum radius for ring/circle map (in meters)|QgsProcessingParameterNumber.Double|10|False|None|None
QgsProcessingParameterNumber|max|Maximum radius for ring/circle map (in meters)|QgsProcessingParameterNumber.Double|20|False|None|None
QgsProcessingParameterString|multiplier|Data value multiplier|1
QgsProcessingParameterNumber|multiplier|Data value multiplier|QgsProcessingParameterNumber.Double|1.0|False|None|None
QgsProcessingParameterBoolean|-b|Generate binary raster map|False
QgsProcessingParameterRasterDestination|output|Circles

0 comments on commit 4b8b6a0

Please sign in to comment.