Navigation Menu

Skip to content

Commit

Permalink
[processing] use point parameter in GRASS algs where possible (addres…
Browse files Browse the repository at this point in the history
…ses #15983)
  • Loading branch information
alexbruy committed Dec 16, 2016
1 parent a0b2605 commit 5dc39e0
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 12 deletions.
4 changes: 2 additions & 2 deletions python/plugins/processing/algs/grass7/description/m.cogo.txt
@@ -1,9 +1,9 @@
m.cogo
A simple utility for converting bearing and distance measurements to coordinates and vice versa. It assumes a cartesian coordinate system
A simple utility for converting bearing and distance measurements to coordinates and vice versa. It assumes a cartesian coordinate system
Miscellaneous (m.*)
ParameterFile|input|Name of input file|False
OutputFile|output|Output text file
ParameterString|coordinates|Starting coordinate pair (default 0.0, 0.0)|0.0,0.0
ParameterPoint|coordinates|Starting coordinate pair|0.0,0.0
*ParameterBoolean|-l|Lines are labelled|False
*ParameterBoolean|-q|Suppress warnings|False
*ParameterBoolean|-r|Convert from coordinates to bearing and distance|False
Expand Down
@@ -1,7 +1,7 @@
r.circle
Creates a raster map containing concentric rings around a given point.
Raster (r.*)
ParameterString|coordinates|The coordinate of the center (east,north)|0,0
ParameterPoint|coordinates|The coordinate of the center (east,north)|0,0
ParameterNumber|min|Minimum radius for ring/circle map (in meters)|None|None|10
ParameterNumber|max|Maximum radius for ring/circle map (in meters)|None|None|20
ParameterString|multiplier|Data value multiplier|1
Expand Down
Expand Up @@ -2,8 +2,8 @@ r.cost
r.cost.coordinates - Creates a raster layer of cumulative cost of moving across a raster layer whose cell values represent cost.
Raster (r.*)
ParameterRaster|input|Unit cost layer|False
ParameterString|start_coordinates|Coordinates of starting point(s) (E,N)|0,0
ParameterString|stop_coordinates|Coordinates of stopping point(s) (E,N)|
ParameterPoint|start_coordinates|Coordinates of starting point(s) (E,N)|0,0
ParameterPoint|stop_coordinates|Coordinates of stopping point(s) (E,N)|0,0
ParameterBoolean|-k|Use the 'Knight's move'; slower, but more accurate|False
ParameterBoolean|-n|Keep null values in output raster layer|True
ParameterNumber|max_cost|Maximum cumulative cost|0|None|0
Expand Down
Expand Up @@ -3,7 +3,7 @@ Traces a flow through an elevation model on a raster map.
Raster (r.*)
ParameterRaster|input|Elevation|False
ParameterRaster|direction|Name of input movement direction map associated with the cost surface|True
ParameterString|start_coordinates|Map coordinates of starting point(s) (E,N)|0.0,0.0|False|True
ParameterPoint|start_coordinates|Map coordinates of starting point(s) (E,N)|0.0,0.0|True
ParameterVector|start_points|Vector layer containing starting point(s)|0|True
ParameterBoolean|-c|Copy input cell values on output|False
ParameterBoolean|-a|Accumulate input values along the path|False
Expand Down
Expand Up @@ -2,12 +2,12 @@ r.horizon
r.horizon.height - Horizon angle computation from a digital elevation model.
Raster (r.*)
ParameterRaster|elevation|Name of input elevation raster map|False
ParameterString|coordinates|Coordinate for which you want to calculate the horizon|0,0
ParameterPoint|coordinates|Coordinate for which you want to calculate the horizon|0,0
ParameterNumber|direction|Direction in which you want to calculate the horizon height|0|360|0.0
ParameterNumber|step|Angle step size for multidirectional horizon [degrees]|0|360|0.0
ParameterNumber|start|Start angle for multidirectional horizon [degrees]|0|360|0
ParameterNumber|end|End angle for multidirectional horizon [degrees]|0|360|360
ParameterNumber|maxdistance|The maximum distance to consider when finding the horizon height|0|None|10000
ParameterString|distance|Sampling distance step coefficient (0.5-1.5)|1.0
ParameterBoolean|-d|Write output in degrees (default is radians)|False
OutputHTML|html|Horizon
OutputHTML|html|Horizon
Expand Up @@ -3,6 +3,6 @@ r.lake.coords - Fills lake at given point to given level.
Raster (r.*)
ParameterRaster|elevation|Elevation|False
ParameterNumber|water_level|Water level|None|None|1000.0
ParameterString|coordinates|Seed point coordinates|0,0
ParameterPoint|coordinates|Seed point coordinates|0,0
ParameterBoolean|-n|Use negative depth values for lake raster layer|False
OutputRaster|lake|Lake
Expand Up @@ -3,5 +3,5 @@ Recursively traces the least cost path backwards to cells from which the cumulat
Raster (r.*)
ParameterRaster|x_input|x_input|False
ParameterRaster|y_input|y_input|False
ParameterString|coordinates|coordinate|0,0
ParameterPoint|coordinates|coordinate|0,0
OutputRaster|output|Backward least cost
Expand Up @@ -2,7 +2,7 @@ r.viewshed
Computes the viewshed of a point on an elevation raster map.
Raster (r.*)
ParameterRaster|input|Elevation|False
ParameterString|coordinates|Coordinate identifying the viewing position|0,0|False|False
ParameterPoint|coordinates|Coordinate identifying the viewing position|0.0,0.0
ParameterString|observer_elevation|Viewing elevation above the ground|1.75|False|False
ParameterString|target_elevation|Offset for target elevation above the ground|0.0|False|False
ParameterString|max_distance|Maximum distance from the viewing point (meters)|-1|False|False
Expand Down
Expand Up @@ -2,7 +2,7 @@ r.what
r.what.coords - Queries raster maps on their category values and category labels on a point.
Raster (r.*)
ParameterRaster|map|Name of raster map|False
ParameterString|coordinates|Coordinates for query (east, north)|None|False|False
ParameterPoint|coordinates|Coordinates for query (east, north)
ParameterString|null_value|String representing NULL value|*|False|True
ParameterString|separator|Field separator. Special characters: pipe, comma, space, tab, newlineString representing NULL value|pipe|False|True
ParameterNumber|cache|Size of point cache|0|None|500|True
Expand Down
1 change: 1 addition & 0 deletions python/plugins/processing/algs/taudem/TauDEMUtils.py
Expand Up @@ -87,6 +87,7 @@ def taudemDescriptionPath():
def executeTauDEM(command, progress):
loglines = []
loglines.append(TauDEMUtils.tr('TauDEM execution console output'))
command = escapeAndJoin(command)
fused_command = ''.join(['"%s" ' % c for c in command])
progress.setInfo(TauDEMUtils.tr('TauDEM command:'))
progress.setCommand(fused_command.replace('" "', ' ').strip('"'))
Expand Down
12 changes: 12 additions & 0 deletions python/plugins/processing/tools/system.py
Expand Up @@ -139,3 +139,15 @@ def mkdir(newdir):
mkdir(head)
if tail:
os.mkdir(newdir)


def escapeAndJoin(strList):
joined = ''
for s in strList:
if s[0] != '-' and ' ' in s:
escaped = '"' + s.replace('\\', '\\\\').replace('"', '\\"') \
+ '"'
else:
escaped = s
joined += escaped + ' '
return joined.strip()

0 comments on commit 5dc39e0

Please sign in to comment.