awesome-spectral-indices / spyndex

Awesome Spectral Indices in Python.
https://spyndex.readthedocs.io/
MIT License
186 stars 22 forks source link

Something wrong with NDWI #14

Closed abreufilho closed 2 years ago

abreufilho commented 2 years ago

Hello, i've been trying to use the computeIndex for NDWI but apart from all other indexes working well, NDWI has been presenting issues so i've tested every way to compute it correctly but it seems something's wrong.

The image below shows the test i've made using the same variables but computeIndex returning the wrong range of values:

image

abreufilho commented 2 years ago

UPDATE: Appears to be an issue with rasterio reading the band without casting ".astype(float)".

Using src.read(band_index).astype(float) fixed it for me.

davemlz commented 2 years ago

Perfect!

I'm closing this issue. Please re-open it if you find it again working wrong ;)

Best,

David