[GIS] Floating point calculations in QGIS

floating pointlandsatqgisrasterraster-calculator

How do I manage floating point calculations in QGIS?

I have carried out 3 consecutive calculations on landsat bands. I end up with 32 bit floating point rasters on which I can't carry out a 4th calculation. The calculation result gives a substantial file but the values of the pixels are shown as "Inf".

I am not able to find a syntax guide for the float() function although I use it successfully in 1 of the preceeding calculations. And I do not have an in-depth understanding of how to manage integer/floating point or how to convert between them in QGIS.

I found these but no big clues

How to reclassify a float raster?
Floating point: understanding their inaccuracy

Best Answer

So I used Int in the calculation instead of Float and had success. The input rasters were 32 floating and the output raster is also 32 floating, so I can't immediately see what effect Int has had. The resulting raster was 0.2 GB, about the same as each of the input rasters.

Int((img1-img2)/img2)

I hate to admit that a google result for Float in an acrgis troubleshooting thread gave me a clue.....

I also became aware that RASTER|CONVERSION|TRANSLATE, where I ignored most of the dialog options and put in some hand rolled commands (-ot as per http://www.gdal.org/gdal_translate.html), could have provided a pathway to convert the data type, but not sure what my objective would be with that.

Related Question