You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@be-marc I have two, ok, in fact three issues/recommendations:
Why is it not possible to post an issue on r-spatial/RSAGA?
The rsaga.wetness.index() documentation claims that out.wetness is optional when it isn't (see code below).
Specifying a wrong parameter name results in an uninformative error message (see code below). Wouldn't it be possible to parse the function parameters and check if the correct ones were provided? Probably in the way how @stevenpawley is doing it in Rsagacmd.
library("RSAGA")
#> Loading required package: gstat#> Loading required package: shapefiles#> Loading required package: foreign#> #> Attaching package: 'shapefiles'#> The following objects are masked from 'package:foreign':#> #> read.dbf, write.dbf#> Loading required package: plyr
data("dem", package="RQGIS")
raster::writeRaster(dem, filename= file.path(tempdir(), "dem.sdat"),
format="SAGA")
#> class : RasterLayer #> dimensions : 117, 117, 13689 (nrow, ncol, ncell)#> resolution : 30.85, 30.85 (x, y)#> extent : 794599.1, 798208.6, 8931775, 8935384 (xmin, xmax, ymin, ymax)#> coord. ref. : NA #> data source : /tmp/Rtmp50WDWm/dem.sgrd #> names : dem #> values : 238, 1094 (min, max)#**********************************************************# 1. rsaga.wetness.index-----------------------------------#**********************************************************# this does not work
rsaga.wetness.index(in.dem= file.path(tempdir(), "dem.sgrd"),
# out.wetness.index = file.path(tempdir(), "twi.sdat"),out.carea= file.path(tempdir(), "carea.sdat"),
out.cslope= file.path(tempdir(), "cslope.sdat"),
area.type=0,
slope.type=1)
#> Error in default.file.extension(out.wetness.index, ".sgrd"): argument "out.wetness.index" is missing, with no default# Specifying out.wetness.index makes it work but in the docu it says this is# optional
rsaga.wetness.index(in.dem= file.path(tempdir(), "dem.sgrd"),
out.wetness.index= file.path(tempdir(), "twi.sdat"),
out.carea= file.path(tempdir(), "carea.sdat"),
out.cslope= file.path(tempdir(), "cslope.sdat"),
area.type=0,
slope.type=1)
#> Search for SAGA command line program and modules... #> Done#> #> #> SAGA Version: 2.3.1#> #> library path: /usr/lib/saga/#> library name: libta_hydrology#> library : Hydrology#> tool : SAGA Wetness Index#> author : (c) 2001 by J.Boehner, O.Conrad#> processors : 8 [8]#> #> Load grid: /tmp/Rtmp50WDWm/dem.sgrd...#> #> #> Parameters#> #> #> Grid system: 30.85; 117x 117y; 794614.532615x 8931790.299603y#> Elevation: dem#> Weights: <not set>#> Catchment area: Catchment area#> Catchment slope: Catchment slope#> Modified Catchment Area: Modified Catchment Area#> Topographic Wetness Index: Topographic Wetness Index#> Suction: 10.000000#> Type of Area: absolute catchment area#> Type of Slope: catchment slope#> Minimum Slope: 0.000000#> Offset Slope: 0.100000#> Slope Weighting: 1.000000#> #> Create index: dem#> catchment area and slope...#> pass 1 (1453 > 0)#> pass 2 (556 > 0)#> pass 3 (294 > 0)#> pass 4 (134 > 0)#> pass 5 (75 > 0)#> pass 6 (38 > 0)#> pass 7 (10 > 0)#> pass 8 (3 > 0)#> pass 9 (0 > 0)#> post-processing...#> topographic wetness index...#> Save grid: /tmp/Rtmp50WDWm/carea.sdat...#> Save grid: /tmp/Rtmp50WDWm/cslope.sdat...#> Save grid: /tmp/Rtmp50WDWm/file2db918af8413...#> Save grid: /tmp/Rtmp50WDWm/twi.sdat...#**********************************************************# 2. Uninformative error messages--------------------------#**********************************************************# let's run rsaga.geoprocessor with a wrongly specified parameter, e.g., we # have written SLOP_TYPE instead of SLOPE_TYPE# The resulting error message is not very informative, would it be possible to# check if the user has specified the correct parameter namesparams=list(DEM= file.path(tempdir(), "dem.sgrd"),
AREA= file.path(tempdir(), "carea.sdat"),
SLOPE= file.path(tempdir(), "cslope.sdata"),
AREA_TYPE=0,
SLOP_TYPE=1)
rsaga.geoprocessor(lib="ta_hydrology", module="SAGA Wetness Index",
param=params)
#> Search for SAGA command line program and modules... #> Done#> Warning in system(command, intern = intern, ...): running command ''/usr/#> bin/saga_cmd' -f=q ta_hydrology 'SAGA Wetness Index' -DEM '/tmp/Rtmp50WDWm/#> dem.sgrd' -AREA '/tmp/Rtmp50WDWm/carea.sdat' -SLOPE '/tmp/Rtmp50WDWm/#> cslope.sdata' -AREA_TYPE '0' -SLOP_TYPE '1'' had status 1#> #> #> SAGA Version: 2.3.1#> #> library path: /usr/lib/saga/#> library name: libta_hydrology#> library : Hydrology#> tool : SAGA Wetness Index#> author : (c) 2001 by J.Boehner, O.Conrad#> processors : 8 [8]#> #> #> Usage: saga_cmd ta_hydrology 15 [-DEM <str>] [-WEIGHT <str>] [-AREA <str>] [-SLOPE <str>] [-AREA_MOD <str>] [-TWI <str>] [-SUCTION <double>] [-AREA_TYPE <str>] [-SLOPE_TYPE <str>] [-SLOPE_MIN <double>] [-SLOPE_OFF <double>] [-SLOPE_WEIGHT <double>]#> -DEM:<str> Elevation#> Grid (input)#> -WEIGHT:<str> Weights#> Grid (optional input)#> -AREA:<str> Catchment area#> Grid (output)#> -SLOPE:<str> Catchment slope#> Grid (output)#> -AREA_MOD:<str> Modified Catchment Area#> Grid (output)#> -TWI:<str> Topographic Wetness Index#> Grid (output)#> -SUCTION:<double> Suction#> Floating point#> Minimum: 0.000000#> Default: 10.000000#> -AREA_TYPE:<str> Type of Area#> Choice#> Available Choices:#> [0] absolute catchment area#> [1] square root of catchment area#> [2] specific catchment area#> Default: 1#> -SLOPE_TYPE:<str> Type of Slope#> Choice#> Available Choices:#> [0] local slope#> [1] catchment slope#> Default: 1#> -SLOPE_MIN:<double> Minimum Slope#> Floating point#> Minimum: 0.000000#> Default: 0.000000#> -SLOPE_OFF:<double> Offset Slope#> Floating point#> Minimum: 0.000000#> Default: 0.100000#> -SLOPE_WEIGHT:<double> Slope Weighting#> Floating point#> Minimum: 0.000000#> Default: 1.000000
Specifying a wrong parameter name results in an uninformative error message (see code below). Wouldn't it be possible to parse the function parameters and check if the correct ones were provided? Probably in the way how @stevenpawley is doing it in Rsagacmd.
@be-marc I have two, ok, in fact three issues/recommendations:
rsaga.wetness.index()
documentation claims thatout.wetness
is optional when it isn't (see code below).Created on 2018-09-07 by the reprex package (v0.2.0).
The text was updated successfully, but these errors were encountered: