Skip to content

Commit

Permalink
[raster] skip non finite values when computing band min/max statistics
Browse files Browse the repository at this point in the history
(cherry-picked from 10044fb)
  • Loading branch information
nirvn authored and nyalldawson committed Mar 19, 2018
1 parent b1d485b commit 1e107ff
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/core/raster/qgsrasterinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,10 +188,11 @@ QgsRasterBandStats QgsRasterInterface::bandStatistics( int bandNo,
if ( blk->isNoData( i ) ) continue; // NULL

double myValue = blk->value( i );

myRasterBandStats.sum += myValue;
myRasterBandStats.elementCount++;

if ( !std::isfinite( myValue ) ) continue; // inf

if ( myFirstIterationFlag )
{
myFirstIterationFlag = false;
Expand Down

0 comments on commit 1e107ff

Please sign in to comment.