babylon.config.h3_splitter

Canonical H3 disaggregation rules — spec 060 FR-011 exception.

The codebase uses uniform splitting as a de facto convention across multiple modules (infrastructure/r8_mesh.py, economics/substrate/spatial.py, economics/substrate/circulation.py) without a single named rule. This module codifies that convention so spec-060 FR-016 (H3 round-trip conservation) has a single source of truth to test against.

Future rules (area-weighted, population-weighted, employment-weighted) can be added as additional H3SplitterRule members; each must preserve the conservation invariant sum(split(v, n)) == v.

See:

specs/060-value-form-invariants/research.md (R1) specs/060-value-form-invariants/data-model.md (H3SplitterRule)

Functions

split_uniformly(parent_value, n_children)

Split a parent quantity equally among n_children children.

Classes

H3SplitterRule(*values)

Canonical H3 disaggregation rules.

class babylon.config.h3_splitter.H3SplitterRule(*values)[source]

Bases: StrEnum

Canonical H3 disaggregation rules.

UNIFORM = 'uniform'
babylon.config.h3_splitter.split_uniformly(parent_value, n_children)[source]

Split a parent quantity equally among n_children children.

Conserves total exactly for the reduction (sum(result) == parent_value within float epsilon) by emitting equal shares.

Parameters:
  • parent_value (float) – The quantity to split.

  • n_children (int) – The number of children (positive integer). For an H3 cell at resolution R, the typical value is 7 (one finer resolution).

Return type:

list[float]

Returns:

A list of n_children floats each equal to parent_value / n_children.

Raises:

ValueError – If n_children < 1.