Nearest Nonmissing Index Map
Map nearest fill source indexes from explicit binary knownness; missing sources are null and nearest-distance ties prefer the earlier index.
Description
Map nearest fill source indexes from explicit binary knownness; missing sources are null and nearest-distance ties prefer the earlier index.
Nearest-neighbor filling can choose a known observation on either side of a gap. A deterministic tie rule matters when both sides are equally close.
When to use this tool
Map nearest fill source indexes from explicit binary knownness; missing sources are null and nearest-distance ties prefer the earlier index.
- Prepare the supplied present fields for this operation.
- Compare the complete example with the representation used by your own input before carrying the result into another step.
How to use the tool and how it works
- Enter present. Use the exact text syntax, units and index conventions explained below.
- Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
- Read result.sourceIndexes. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.
From a binary present mask, find the known index minimizing absolute index distance for each position. Break equal-distance ties in favor of the smaller index and return null when no known entries exist.1
| Input field | Meaning and representation | Accepted input |
|---|---|---|
| present | present. | List of finite numbers; bounded by the operation |
| Output field | Interpretation |
|---|---|
| result | Object containing the named outputs below. |
| result.sourceIndexes | Original zero-based source positions, under the ordering described above. |
{
"input": {
"present": [
0,
1,
0,
0,
1
]
},
"output": {
"result": {
"sourceIndexes": [
1,
1,
1,
4,
4
]
}
}
} Limitations and assumptions
- Distance is purely positional, not temporal. The map does not interpolate or copy values, and the same known entry may be selected for many positions.
- Every declared top-level field is required and unexpected fields are rejected. Numeric inputs must be finite; ordinary text fields are bounded to 8,192 UTF-16 code units, with tighter operation-specific limits where stated.
- Ordinary string lists have at most 128 entries of at most 128 code units each; numeric lists and matrices have separate bounded size checks. Nonfinite results and excessively large serialized outputs are rejected.
- Indexes are zero-based and spans have an exclusive end unless explicitly stated otherwise. A valid false, null or empty-list result is distinct from malformed input.
Alternative or Complementary methods
Use explicit source-index maps when rearranging data or planning missing-value fills. Keep row-major coordinates, cyclic indexes and one-based occurrence numbers distinct, and inspect null donor positions before copying values.
References
Similar or alternative tools
- Adjacent Change Indexes
Return indexes whose value differs from the previous supplied string, not CSS change hints or a value transform.
- Alternating Sign Run Segmenter
Segment consecutive strictly alternating nonzero signs; zeros and equal adjacent signs break runs.