Skip to content
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

Mosaic: adds band and datatype checks #313

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jfbourdon
Copy link
Contributor

Partially fix #309

Explicitly tell the user that the tool can only work with single band and single data type rasters. I had to modify the GeoTiff reader in order to expose the number of bands inside a GeoTiff as before is was always set to one.

A better solution would be to edit the tool in order for it to accept multiband raster but that is more work.

@brownag
Copy link
Contributor

brownag commented Jan 9, 2023

This is a great addition! Is there a place that multi-band input can be checked more generally in the GeoTIFF reader rather than in the tool itself? I think most tools encounter problems when fed a multiband TIFF file

@jfbourdon
Copy link
Contributor Author

Do you suggest to consider any multiband GeoTIFF as invalid when loaded? If so, it would be an issue with some tools that either support or require multiband like RgbToIhs, SplitColourComposite and MosaicWithFeathering. Also, WhiteboxTools' native raster format (.tas/.dep) support multiband. That being said, it's true that most raster tools expect single band raster and that there isn't a systematic check currently.

@brownag
Copy link
Contributor

brownag commented Jan 9, 2023

Do you suggest to consider any multiband GeoTIFF as invalid when loaded?

Yeah, I was suggesting that. The manual does state multi-band GeoTIFF are not supported. https://www.whiteboxgeo.com/manual/wbt_book/supported_formats.html

If so, it would be an issue with some tools that either support or require multiband like RgbToIhs, SplitColourComposite and MosaicWithFeathering.

I must admit I didn't realize these tools worked with multi-band GeoTIFF input. I just tested RgbToIhs with an RGB GeoTIFF and can confirm it does run via --composite. And SplitColourComposite expects a composite image. Both write result bands as separate files.

Also, WhiteboxTools' native raster format (.tas/.dep) support multiband.

I think my suggestion is mainly for cases where reading of GeoTIFF input would cause a confusing error in a tool.

Perhaps tool parameters need a new flag in the metadata to reflect when they support multiband input

@jfbourdon
Copy link
Contributor Author

The manual does state multi-band GeoTIFF are not supported

I missed that part in the manual... but it seems that the manual is wrong as you found out yourself, at least for multiband RGB/RGBA Uint8 GeoTIFF.

I really think that there should be an explicit check for multiband in all raster tool. We'll see what Lindsay has to say on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Failed to use the mosaic function in whitebox (python script)
2 participants