-
Notifications
You must be signed in to change notification settings - Fork 161
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failed to use the mosaic function in whitebox (python script) #309
Comments
Your issue most likely has to do with your input files. The number of bits per sample of the files seems to not have been parsed correctly. Can you share your two input files? |
Hello, Here are the tif files. Best regards |
I made some tests found two things that are wrong: First, the header of your TIFF files is not complety right. I can't say exactly what, but it's something minor enough that GDAL can bypass it but major enough that WhiteboxTools cannot. In fact, if you do a The second issue is that the Mosaic tool expect only single band rasters even thought the documentation doesn't specify it. Using a two band raster will interleave both bands in the merged (single band) raster instead of merging each band independently. Also, it doesn't play here, but if the input raster doesn't have a NoData defined (like yours), the tool will force one anyway in the output raster according to the data type, in this case -32768 for an Int16. |
Now I understand it. Thank you for your response. |
Hello,
I find that there is a problem when I tried to use the mosaic function in the whitebox python package.
I used the following codes (according to the example in the tutorial):
import os,glob
import whitebox
wbt=whitebox.WhiteboxTools()
wbt.set_verbose_mode(True)
input_directory = r"M:\Clumpingindex\test"
output_directory = r"M:\Clumpingindex\output"
if os.path.isdir(output_directory) != True:
os.mkdir(output_directory)
wbt.set_working_dir(input_directory)
outfile = os.path.join(output_directory,"test.tif")
wbt.mosaic(
output=outfile,
method = "nn"
)
and here is the error report:
.\whitebox_tools.exe --run="Mosaic" --wd="M:\Clumpingindex\test" --output='M:\Clumpingindex\output\NAME_OF_FILE.tif' --method=nn -v --compress_rasters=True
Number of tiles: 2
Reading data...
thread 'main' panicked at 'index out of bounds: the len is 2 but the index is 2', whitebox-raster\src\geotiff\mod.rs:797:44
note: run with
RUST_BACKTRACE=1
environment variable to display a backtraceCan you help me fix this problem? Thanks a lot.
Best regards
The text was updated successfully, but these errors were encountered: