Open jannes-m opened 6 years ago
- Why is it not possible to post an issue on r-spatial/RSAGA?
Should be possible soon. I have sent a message to owner of r-spatial
- The rsaga.wetness.index() documentation claims that out.wetness is optional when it isn't (see code below).
out.wetness
is now optional https://github.com/r-spatial/RSAGA/commit/66ea4e9fd5d0428a8aeefee0172dba0a972f2d64
- 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.
I added this as a new feature https://github.com/r-spatial/RSAGA/commit/86e1957adf23bd2dd463555414b238ffd6cc71a3
@be-marc Excellent!! Thanks for all the hard work!! Will give it a try soon!
@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).**
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"),
> 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:
> 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 names
params = 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] [-WEIGHT ] [-AREA ] [-SLOPE ] [-AREA_MOD ] [-TWI ] [-SUCTION ] [-AREA_TYPE ] [-SLOPE_TYPE ] [-SLOPE_MIN ] [-SLOPE_OFF ] [-SLOPE_WEIGHT ]
> -DEM: Elevation
> Grid (input)
> -WEIGHT: Weights
> Grid (optional input)
> -AREA: Catchment area
> Grid (output)
> -SLOPE: Catchment slope
> Grid (output)
> -AREA_MOD: Modified Catchment Area
> Grid (output)
> -TWI: Topographic Wetness Index
> Grid (output)
> -SUCTION: Suction
> Floating point
> Minimum: 0.000000
> Default: 10.000000
> -AREA_TYPE: Type of Area
> Choice
> Available Choices:
> [0] absolute catchment area
> [1] square root of catchment area
> [2] specific catchment area
> Default: 1
> -SLOPE_TYPE: Type of Slope
> Choice
> Available Choices:
> [0] local slope
> [1] catchment slope
> Default: 1
> -SLOPE_MIN: Minimum Slope
> Floating point
> Minimum: 0.000000
> Default: 0.000000
> -SLOPE_OFF: Offset Slope
> Floating point
> Minimum: 0.000000
> Default: 0.100000
> -SLOPE_WEIGHT: Slope Weighting
> Floating point
> Minimum: 0.000000
> Default: 1.000000