3

When I try to perform the conditional tools "wbt_conditional_evaluation" in R, I get this message error :

Error running WhiteboxTools (conditional_evaluation)
  whitebox.exe_path: "C:/R/R-4.1.1/library/whitebox/WBT/whitebox_tools.exe"; File exists? TRUE
  Arguments: --run=conditional_evaluation  --input="./acc_mean_mod_bol.tif" --output="./acc_mean_R_max.tif" --statement=value == 1 --true=./acc_mean_R_mod.tif --false=./acc_mean_R.tif --compress_rasters=FALSE -v --max_procs=-1

System command had status 101
conditional_evaluation - Elapsed Time: NA [did not run] "

Here the parameters :

wbt_conditional_evaluation(input = "./acc_mean_mod_bol.tif",
                           statement = "value == 1",
                           true = "./acc_mean_R_mod.tif",
                           false = "./acc_mean_R.tif",
                           output = "./acc_mean_R_max.tif")

The true and false inputs are flow accumulation rasters.

I use this tool to create the bolean raster (acc_mean_mod_bol.tif)

wbt_greater_than(input1 = "./acc_mean_R_mod.tif", 
                 input2 = "./acc_mean_R.tif", 
                 output = "./acc_mean_R_mod_bol.tif")

Does anyone know what I'm doing wrong? And is there a way to summarise these two operations by only using the function "wbt_raster_calculator". I'm trying to do this equivalent operation in ArcGIS raster calculator:

Con("acc_mean_R_mod.tif" > "acc_mean_R.tif","acc_mean_R_mod.tif","acc_mean_R.tif")
3
  • I don't like the look of the spaces in --statement=value == 1 in the command. Can you try it with statement = "value==1" in the R call (that is, no spaces inside the quotation marks)? If that works I'll write up an answer, if it doesn't work you might need to make a reproducible example.
    – Spacedman
    Commented Mar 30, 2022 at 18:27
  • 1
    I get a line saying "thread 'main' panicked at 'Unrecognized tool name conditional_evaluation.', whitebox-tools-app/src/main.rs:72:21" before getting your error. Are you seeing that? It looks like (for me) the R package and the underlying Whitebox Tools aren't compatible...
    – Spacedman
    Commented Mar 31, 2022 at 11:26
  • I just tried with a fresh install of whitebox R package from github and let it get the WBT tools package it wanted. Still failed. If you can edit the reproducible example into your Q its probably worth posting an issue to their issue tracker: github.com/giswqs/whiteboxR/issues
    – Spacedman
    Commented Mar 31, 2022 at 11:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.