4

I am comparing two raster temperature files generated from two different sources that use different algorithms. One of them is provided as a floating point (temp(C)) and the other is integer (temp(C)*10). I generated statistics for both using QGIS Raster Layer Statstics. Both files have extensive areas of no data values (-3.402...e+38 and -9999).

When I calculate statistics, QGIS provides an apparently erroneous mean value for the integer-scaled file:

Valid cells: 153660
No-data cells: 200134
Minimum value: 141
Maximum value: 270
Sum: 36204112
Mean value: 147
Standard deviation: 84.0595027347

In particular note that 36204112/153660 = 235.61, not the reported 147. This problem appears to affect the Standard deviation as well.

The same operation appears to work for corresponding the floating point file:

Valid cells: 153773
No-data cells: 200021
Minimum value: 14.6999998093
Maximum value: 26.0
Sum: 3524999.0977
Mean value: 22.923394209
Standard deviation: 1.56633585615

In this case, the operation 3524999/153773 produces the same result as the output Mean (22.92...)

Indeed, when I convert the integer file to float (raster calculator: * 0.1), the stats calculation seems to work as expected. And when I convert the other file that was originally in float to integer, the stats calculation becomes erroneous.

In other words, there appears to be an error in stats calculation of integer raster files.

Is this a bug or am I missing something?

Perhaps the best way to avoid is to always use float.

I am running QGIS 2.18.2 on MacOSX10.10.5.

  • 1
    This should probably be a bug report on issues.qgis.org/issues. Make sure you provide the dataset so devs can try to reproduce and test the issue – underdark May 20 '17 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.