Bug report #11135
Zonal Statistics is calculating wrong mean values
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Analysis library | ||
Affected QGIS version: | master | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 19463 |
Description
Hello,
the Zonal Statistics tool doesn't work correctly (wrong MEAN value). Here is a link to the Forum-question: [[http://gis.stackexchange.com/questions/112435/is-there-an-issue-with-zonal-statistics-calculating-wrong-mean-values]]
I'm using QGIS 2.2.
Associated revisions
Fix calculation of zonal stats when source contains nodata or nan
pixels (fix #11135)
Fix calculation of zonal stats when source contains nodata or nan
pixels (fix #11135)
History
#1 Updated by Giovanni Manghi about 10 years ago
- File rast2.tif added
- Category set to 94
- Affected QGIS version changed from 2.4.0 to master
I can confirm this on the latest master, where both the tool in the raster menu and in the processing toolbox (one C++ and the other python) make the same error and give the wrong result.
The provided test raster has no data areas and once transformed them into 0 then the zonal stats tool returns the same mean value, meaning that it seems no data is taken into account as 0.
Please notice also that:
with the processing tool and the provided sample raster the "min" and "max" values do not make any sense (and it seems to give the wrong values with any input raster)
other computed values too, both with the processing tool and the C++ plugin seems odd.
#2 Updated by Alexander Bruy about 10 years ago
- Category changed from 94 to Processing/QGIS
#3 Updated by Paolo Cavallini over 9 years ago
- Category changed from Processing/QGIS to 115
I confirm; the problem seems to lay in the core C++ plugin rather than in Processing, and it is due to NULL values
#4 Updated by Nyall Dawson over 9 years ago
- Status changed from Open to Closed
Fixed in changeset 213a22bc8ac936ff0c0179d565ca3bd5cf1f68f3.
#5 Updated by Paolo Cavallini over 9 years ago
Thanks Nyall. Has this been backported?
#6 Updated by Giovanni Manghi almost 8 years ago
- Category changed from 115 to Analysis library
#7 Updated by Spencer Gardner almost 8 years ago
- Status changed from Closed to Reopened
I'm seeing a regression in this on 2.18.3 in Linux. There are no Zonal Statistics in the Raster menu, but the Processing routine seems to be having the same problem as described above. Is this a bad implementation in processing now? If so, I'll open a new bug.
#8 Updated by Nyall Dawson almost 8 years ago
- Status changed from Reopened to Closed
Sounds like a different issue - processing doesn't reuse this library (until 3.0, when it does). You'll need to open a new issue against processing.