[gdal-dev] Image values greater than the maximum.

Even Rouault even.rouault at mines-paris.org
Wed Jun 11 14:01:34 EDT 2008


Michele,

Here's what I tried on 1.5 SVN branch :

even at pc-amd64:~/downloads/mapserver/gdal.svn.commit/branches/1.5/gdal$ 
apps/gdalinfo -stats ../../../gdal/095b_dem_90m.asc
Driver: AAIGrid/Arc/Info ASCII Grid
Files: ../../../gdal/095b_dem_90m.asc
....
  Minimum=213.000, Maximum=578.000, Mean=354.816, StdDev=83.352
  NoData Value=-9999

even at pc-amd64:~/downloads/mapserver/gdal.svn.commit/branches/1.5/gdal$ 
apps/gdalinfo -approx_stats ../../../gdal/095b_dem_90m.asc
Driver: AAIGrid/Arc/Info ASCII Grid
Files: ../../../gdal/095b_dem_90m.asc
...
  Minimum=213.000, Maximum=538.000, Mean=355.264, StdDev=83.247
  NoData Value=-9999

So, with bApproxOK=FALSE, the maximum is 578, where as with bApproxOK=TRUE it 
is 538. But, but, but, I had to remove the 095b_dem_90m.asc.aux.xml file that 
stores these results of computations. So I guess it is at the root of the 
strange phenomena you see.

You have probably done the first time an approximate computation, that was 
stored in the .aux.xml file, and then when you ask for an exact computation 
it finds the values in the .aux.xml file and doesn't compute them afterwards.
I don't think the bApproxOK paramater can have any influence on the RasterIO 
result (and really can't see how it could), but you probably got confused by 
the order in which you did all those operations.


Le Wednesday 11 June 2008 09:57:24 Michele Sanges, vous avez écrit :
> I noticed a problem in my code; it's reproducible with the
> Arc/Info_ASCII_GRID gdal dataset taken from:
>
> http://download.osgeo.org/gdal/data/aaigrid/095b_dem_90m.asc
>
> If I call the function GDALComputeRasterMinMax() with the second
> parameter 'bApproxOK' set to FALSE, I get the values:
>
> * min=213
> * max=538
>
> Then, when I go to read the image with the ReadIO function, all of the
> values are within this range and this is ok.
>
> Instead if I call the function GDALComputeRasterMinMax() with the second
> parameter 'bApproxOK' set to TRUE, I get the same above min and max
> values but when I go to read the image, some of the values are greater
> than the maximum.
>
> Why the parameter 'bApproxOK' has influence on the values of data?
>
> Thanks.
> Michele
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev




More information about the gdal-dev mailing list