Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

attribute.statistics

Measure a numeric attribute column into a Data table: count, min, max, mean, median, stddev (over the whole population), sum, and percentiles, the nine deciles p10 through p90, each interpolated between the two sorted values it falls between. Reading a threshold off these is what makes a rule relative to the data it runs on.

Inputs

  • geometry (Geometry). Whose column is measured. Nothing about it changes; the node answers a Data table only.
  • class (one of detail, edge, point, primitive, vertex). Default "point". Which rows are measured: the class the column lives on, and the population every statistic is taken over.
  • name (String). Default "". Which column to measure. It has to be a one-number-per-element column; a name the class does not carry is refused.

Outputs

  • stats: the Data table { count, min, max, mean, median, stddev, sum, percentiles = { p10, p20, ..., p90 } }.

Example

local points = g.points.grid({ countX = 4, countZ = 1, spacing = 1 })
local numbered = g.attribute.number({ geometry = points, class = "point", name = "n" })
local stats = g.attribute.statistics({ geometry = numbered, name = "n" })

For the values 0, 1, 2, 3: count 4, sum 6, mean and median 1.5, stddev 1.118, percentiles.p90 2.7.