whitebox-tools
whitebox-tools copied to clipboard
Unrecognized tool name Geomorphons
I previously posted that I could not run the geomorphons tool in python and it was pointed out that it would not be available until version 2.1 was released. I have since upgraded whitebox tools and I am running 2.1.1. However, I still cannot use the geomorphons. I get the following error now:
thread 'main' panicked at 'Unrecognized tool name Geomorphons.'
The code: `geom_output = geom_path+"\"+raster_root_name+"_Geom.tif"
wbt.geomorphons(dem, geom_output, search = 6, threshold = 2, tdist = 1, forms = True)`
Any help is appreciated!
Can you please upload your whole script? Importantly, I would like to see your import of WBT. What install method did you use for Whitebox? Are you using the Python API that comes with the WBT download, or did you install using Qiusheng Wu's pip-based install and Python API?
Having done the testing just now, I can confirm that my test script, which uses the simple Python API that is distributed with the WhiteboxTools download off of the Whitebox Geospatial website works as expected:
from WBT.whitebox_tools import WhiteboxTools
wbt = WhiteboxTools()
print(wbt.version())
geom_input = "/Users/johnlindsay/Documents/data/Grand Junction CO/DEM_15m.tif"
geom_output = "/Users/johnlindsay/Documents/data/Grand Junction CO/geomorphons.tif"
wbt.geomorphons(
dem = geom_input,
output = geom_output,
search = 6,
threshold = 2,
tdist = 1,
forms = True
)
Output:
["--dem='/Users/johnlindsay/Documents/data/Grand Junction CO/DEM_15m.tif'", "--output='/Users/johnlindsay/Documents/data/Grand Junction CO/geomorphons.tif'", '--search=6', '--threshold=2', '--tdist=1'] ./whitebox_tools --run="Geomorphons" --dem='/Users/johnlindsay/Documents/data/Grand Junction CO/DEM_15m.tif' --output='/Users/johnlindsay/Documents/data/Grand Junction CO/geomorphons.tif' --search=6 --threshold=2 --tdist=1 --forms
- Welcome to Geomorphons *
- Powered by WhiteboxTools *
- www.whiteboxgeo.com *
Reading data... Generating global ternary codes... Computing geomorphons... Progress: 0% Progress: 1% Progress: 2% Progress: 3% Progress: 4% Progress: 5% Progress: 6% Progress: 7% Progress: 8% Progress: 9% Progress: 10% Progress: 11% Progress: 12% Progress: 13% Progress: 14% Progress: 15% Progress: 16% Progress: 17% Progress: 18% Progress: 19% Progress: 20% Progress: 21% Progress: 22% Progress: 23% Progress: 24% Progress: 25% Progress: 26% Progress: 27% Progress: 28% Progress: 29% Progress: 30% Progress: 31% Progress: 32% Progress: 33% Progress: 34% Progress: 35% Progress: 36% Progress: 37% Progress: 38% Progress: 39% Progress: 40% Progress: 41% Progress: 42% Progress: 43% Progress: 44% Progress: 45% Progress: 46% Progress: 47% Progress: 48% Progress: 49% Progress: 50% Progress: 51% Progress: 52% Progress: 53% Progress: 54% Progress: 55% Progress: 56% Progress: 57% Progress: 58% Progress: 59% Progress: 60% Progress: 61% Progress: 62% Progress: 63% Progress: 64% Progress: 65% Progress: 66% Progress: 67% Progress: 68% Progress: 69% Progress: 70% Progress: 71% Progress: 72% Progress: 73% Progress: 74% Progress: 75% Progress: 76% Progress: 77% Progress: 78% Progress: 79% Progress: 80% Progress: 81% Progress: 82% Progress: 83% Progress: 84% Progress: 85% Progress: 86% Progress: 87% Progress: 88% Progress: 89% Progress: 90% Progress: 91% Progress: 92% Progress: 93% Progress: 94% Progress: 95% Progress: 96% Progress: 97% Progress: 98% Progress: 99% Progress: 100% Saving data... Output file written Elapsed Time (excluding I/O): 0.47s
I used the pip install. Checking the version shows that I am running 2.1.1. Do I need to use the download from the website? If so, how do I access it from a conda environment?
I stripped out the rest of the script to avoid confusion. Here is the full code for just running the geomorphons.
import whitebox
wbt = whitebox.WhiteboxTools()
raster_root_name = "TestTiles" working_dir = r"C:\Users\cflynn\GeomTest" sm_dem = r"C:\Users\cflynn\GeomTest\TileGrid5_sm_DEM.tif"
geom_output = working_dir+"\"+raster_root_name+"_Geom.tif"
wbt.geomorphons(sm_dem, geom_output, search = 6, threshold = 2, tdist = 1, forms = True)
I stumbled on this as well and I believe it might be an Anaconda issue. Downloading Whitebox and using the API works fine. However, the pip installed version seems outdated. PyPI claims that it is 2.2.0 but when I run print(wbt.version()) it says v2.0.0.
The same does not happen in google colab:
!pip install whitebox
import whitebox
wbt = whitebox.WhiteboxTools()
print(wbt.version())
Downloading whitebox-2.2.0-py2.py3-none-any.whl (79 kB) |████████████████████████████████| 79 kB 3.7 MB/s Requirement already satisfied: Click>=6.0 in /usr/local/lib/python3.8/dist-packages (from whitebox) (7.1.2) Installing collected packages: whitebox Successfully installed whitebox-2.2.0 Downloading WhiteboxTools pre-compiled binary for first time use ... Decompressing WhiteboxTools_linux_amd64.zip ... WhiteboxTools package directory: /usr/local/lib/python3.8/dist-packages/whitebox Downloading testdata ... WhiteboxTools v2.2.0 by Dr. John B. Lindsay (c) 2017-2023
WhiteboxTools is an advanced geospatial data analysis platform developed at the University of Guelph's Geomorphometry and Hydrogeomatics Research Group (GHRG). See www.whiteboxgeo.com for more details.
One solution you could use for now is to download the whitebox API and call it from your python script instead of importing the pip installed version.
import sys
sys.path.insert(1, r'C:\william_program\WhiteboxTools_win_amd64\WBT') #This is where whitebox tools is stored.
from whitebox_tools import WhiteboxTools
wbt = WhiteboxTools()
Try uninstalling the package and removing the WBT folder under the package. Reinstall it again should automatically download the latest WBT binary.
Hi @cflynn8,
Looking to follow up on this issue. Are you still being impacted by this or has one of the comments above resolved your issue?