Elevation statistics for a DEM grid
The mean, lowest, highest, relief, standard deviation, and median of a grid of elevations, with how many cells hold data.
The 20 cells average 213.235 m, from 210.8 m to 215.2 m.
- Lowest elevation
- Highest elevation
- Relief
- Standard deviation
- Median elevation
- Cells with data
Provenance
- Computed by
- raster.terrain.dem-stats 1.0.0, core 0.1.0
- Model
- Over the cells that hold data: mean = Σz / n, population standard deviation = √(Σ(z − mean)² / n), median the middle of the sorted values (the mean of the two middle ones when n is even), relief = highest − lowest
- Accuracy
- Exact arithmetic on the elevations given; the mean and standard deviation match gdalinfo -stats, which uses the same population formula
- Notes
- None
- Cites
- GDAL/OGR contributors, Open Source Geospatial Foundation, gdalinfo
Something look off?
How we got thisFormula, worked example, sources, and proof
Model: Over the cells that hold data: mean = Σz / n, population standard deviation = √(Σ(z − mean)² / n), median the middle of the sorted values (the mean of the two middle ones when n is even), relief = highest − lowest
Accuracy: Exact arithmetic on the elevations given; the mean and standard deviation match gdalinfo -stats, which uses the same population formula
When to use this: Use this to summarize a small DEM, a site survey on a grid, or a clip of a larger model: its average and middle elevations, its range, and how much it varies. It is also a quick check of what a GIS reports for the same cells, since the standard deviation here is the population form that gdalinfo uses.
Limitations: The statistics treat every cell alike, so they describe the grid, not the ground: on a geographic grid, cells far from the equator cover less ground and still count fully. Cells marked with the no-data value are left out, so a grid mostly of gaps describes only the cells left. At most 300 by 300 cells.
Worked example: A 4 by 5 site grid. Source: NumPy, with gdalinfo 3.13.3 -stats for the mean and standard deviation (tools/vectors/gen_dem_grid.py). It is golden test vector v001, and every build checks the tool still gives its answer within its tolerance.
You enter
- Elevation grid
- 212.4, 213.1, 214.0, 214.8, 215.2 211.9, 212.6, 213.7, 214.5, 215.0 211.2, 212.0, 213.1, 214.1, 214.6 210.8, 211.5, 212.4, 213.6, 214.2
You get
- Mean elevation
- 213.235 m
- Lowest elevation
- 210.8 m
- Highest elevation
- 215.2 m
- Relief
- 4.4 m
- Standard deviation
- 1.299 m
- Median elevation
- 213.35 m
- Cells with data
- 20
- No-data cells
- 0
Review: Not yet independently reviewed by a GIS professional.
Last verified: 2026-10-14, when a maintainer last confirmed this tool's sources at the issuer. See the sources ledger.
Status: version 1.0.0, core 0.1.0. See this tool in the verification report.
Changes
- 2026-10-14, changed: DEM statistics, the highest point of a DEM grid, and the volume change between two DEM grids are now stable. Each is held to NumPy on 24 grids or survey pairs (the statistics also to gdalinfo -stats) and to invariant tests for shifting, swapping, and gapping the grids. Results are unchanged. Changelog
Checked against: 25 golden test vectors (download the test vectors, each with its source and tolerance). See how results are checked and every source.
Sources
- gdalinfo, GDAL/OGR contributors, Open Source Geospatial Foundation, GDAL 3.13.3 documentation. -stats: read and display image statistics (minimum, maximum, mean, and standard deviation of the valid pixels).
Terms
- DEM: digital elevation model
- A grid of elevations. A surface model includes buildings and canopy; a terrain model is the ground beneath them. Source: Copernicus DEM GLO-30