0

Statistics (mean, min, max) change quite a lot after importing a .TIF grid file (DEM) into GRASS. According to GDAL queries in QGIS, the TIF has the following properties:

STATISTICS_MAXIMUM=2.2400000095367
STATISTICS_MEAN=0.05137734831008
STATISTICS_MINIMUM=-3.5300002098083
STATISTICS_STDDEV=0.43984890430363

After import in GRASS, with region set according to this grid (extent & cellsize), GRASS lists the properties as follows:

...
minimum: -4.21
maximum: 2.99
...
mean: 0.0451878
standard deviation: 0.435221

Especially the difference in the 'mean' worries me a bit. I checked extent and cell size, they are identical.

Does anybody have any idea why the results (especially the 'mean') are different?

I'm new to this forum, and pretty much a beginner with GRASS (7.0.0beta3 installed atm).

2
  • Be sure to have the grasswiki.osgeo.org/wiki/Computational_region set properly to the raster map.
    – markusN
    Mar 3, 2015 at 19:21
  • Thanks for the tip. However, I did set the computational region in GRASS according to the properties of the imported grid and verified this step, before I calculated the statistics.
    – Eelco
    Mar 4, 2015 at 12:27

1 Answer 1

1

Sometimes, the statistics are calculated through sampling. This could cause the differences. Try to use gdalinfo with the -stat option to calculate image statistics and see if there are differences

3
  • thanks for the tip. I recalculated statistics for the original TIF using gdalinfo -stats, but the numbers do not change unfortunately. So the change in statistics after import into GRASS remains. Do you, or anybody else, have any suggestion what else could explain the difference?
    – Eelco
    Mar 4, 2015 at 12:00
  • For verification, I just loaded the original TIF in ArcView and (re)calculated the statistics. They proved to be identical to GRASS numbers. So I think you are on the right track with your suggestion. I am guessing that gdalinfo (with or without -stats) somehow makes a mistake in calculating statistics. Maybe because of the technique it uses for this (sampling).
    – Eelco
    Mar 4, 2015 at 13:05
  • Note: gdalinfo -mm Force computation of the actual min/max values for each band in the dataset (rather than using heuristics)
    – markusN
    Mar 5, 2015 at 7:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.