[gdal-dev] Wrong statistics from gdalinfo

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[gdal-dev] Wrong statistics from gdalinfo

Rahkonen Jukka (Tike)
Hi,

My colleague found that gdalinfo -stats is giving wrong statistics for this
7.8 GB sized GeoTIFF file http://latuviitta.kapsi.fi/data/dem10m/dem_10m.tif

Gdalinfo -stats is listing

...
  Min=-999.999 Max=893.885
  Minimum=-999.999, Maximum=893.885, Mean=41.967, StdDev=174.896
  Metadata:
    STATISTICS_MAXIMUM=893.88500976563
    STATISTICS_MEAN=41.9674566748
    STATISTICS_MINIMUM=-999.9990234375
    STATISTICS_STDDEV=174.89632155312

However, there are higher values in this DEM and gdallocationinfo proves it:

C:\>gdallocationinfo -geoloc /vsicurl/
http://latuviitta.kapsi.fi/data/dem10m/dem_10m.tif 278281 7689681
Report:
  Location: (22228P,9232L)
  Band 1:
    Value: 1005.67901611328

-Jukka Rahkonen-

_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Wrong statistics from gdalinfo

Even Rouault-2
Jukka,

I suspect the file has been updated after first statistics have been computed,
or perhaps they have been computed in -approx_stats mode.

gdalinfo -stats doesn't recompute statistics if they are already stored in the
file.

I've done a "gdal_translate dem_10m.tif out.tif -co tiled=yes -co
compress=deflate -stats" to force statistics recomputation

The updated stats are :
    STATISTICS_MAXIMUM=2002.291015625
    STATISTICS_MEAN=49.848418026241
    STATISTICS_MINIMUM=-1059.7540283203
    STATISTICS_STDDEV=163.15374152281

I've just added a -unsetstats flag to gdal_edit.py to clear statistics.

Even

Le mercredi 27 août 2014 12:03:07, Jukka Rahkonen a écrit :

> Hi,
>
> My colleague found that gdalinfo -stats is giving wrong statistics for this
> 7.8 GB sized GeoTIFF file
> http://latuviitta.kapsi.fi/data/dem10m/dem_10m.tif
>
> Gdalinfo -stats is listing
>
> ...
>   Min=-999.999 Max=893.885
>   Minimum=-999.999, Maximum=893.885, Mean=41.967, StdDev=174.896
>   Metadata:
>     STATISTICS_MAXIMUM=893.88500976563
>     STATISTICS_MEAN=41.9674566748
>     STATISTICS_MINIMUM=-999.9990234375
>     STATISTICS_STDDEV=174.89632155312
>
> However, there are higher values in this DEM and gdallocationinfo proves
> it:
>
> C:\>gdallocationinfo -geoloc /vsicurl/
> http://latuviitta.kapsi.fi/data/dem10m/dem_10m.tif 278281 7689681
> Report:
>   Location: (22228P,9232L)
>   Band 1:
>     Value: 1005.67901611328
>
> -Jukka Rahkonen-
>
> _______________________________________________
> gdal-dev mailing list
> [hidden email]
> http://lists.osgeo.org/mailman/listinfo/gdal-dev

--
Spatialys - Geospatial professional services
http://www.spatialys.com
_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev
Reply | Threaded
Open this post in threaded view
|

Re: Wrong statistics from gdalinfo

Rahkonen Jukka (Tike)
In reply to this post by Rahkonen Jukka (Tike)
> Jukka,
>
> I suspect the file has been updated after first statistics have been computed, or
> perhaps they have been computed in -approx_stats mode.
>
> gdalinfo -stats doesn't recompute statistics if they are already stored in the file.

All right, the statistics are how they are because the big GeoTIFF is created from this VRT file
http://latuviitta.kapsi.fi/data/dem10m/dem_10m.vrt

The wrong statistics seem to be stored into VRT. I do not know where the statistics came into VRT. The VRT has been created with gdalbuildvrt.

-Jukka-
_______________________________________________
gdal-dev mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/gdal-dev