RS_SummaryStatsAll¶
Returns every summary statistic of a band’s pixel values as a struct of six doubles: count, sum, mean, stddev, min and max.
Usage¶
struct RS_SummaryStatsAll(rast: raster)
struct RS_SummaryStatsAll(rast: raster, band: integer)
struct RS_SummaryStatsAll(rast: raster, band: integer, exclude_nodata: boolean)
Arguments¶
- rast (raster): Input raster
- band (integer): Band index (1-based). Defaults to 1 if not specified.
- exclude_nodata (boolean): Whether to leave pixels holding the band’s nodata value out of the statistics. Defaults to true.
Description¶
The fields are the statistics RS_SummaryStats returns one at a time,
with the same values: stddev is the population standard deviation, and
over no pixels (for example, a band that is entirely nodata) count and
sum are 0 and the other fields are NaN. Computing them together scans
the band three times, where six RS_SummaryStats calls would scan it
more often.
A band the raster does not have, or a 64-bit integer pixel beyond 2^53 in magnitude (which a double cannot hold exactly), is an error. Only 2-D rasters are supported.
Examples¶
SELECT RS_SummaryStatsAll(RS_Example());
┌──────────────────────────────────────────────────────────────────────────┐
│ rs_summarystatsall(rs_example()) │
│ struct │
╞══════════════════════════════════════════════════════════════════════════╡
│ {count: 2047.0, sum: 2047.0, mean: 1.0, stddev: 0.0, min: 1.0, max: 1.0} │
└──────────────────────────────────────────────────────────────────────────┘
SELECT RS_SummaryStatsAll(RS_Example(), 1, false);
┌──────────────────────────────────────────────────────────────────────────────┐
│ rs_summarystatsall(rs_example(),Int64(1),Boolean(false)) │
│ struct │
╞══════════════════════════════════════════════════════════════════════════════╡
│ {count: 2048.0, sum: 2174.0, mean: 1.0615234375, stddev: 2.783553123552375,… │
└──────────────────────────────────────────────────────────────────────────────┘