moczarr.fabricate
Exact NESTED cell_ids fabricated from packed morton words.
The morton-only storage decision (englacial/zagg#262: "NESTED is fabricated,
never stored") drops the stored NESTED cell_ids array from hive leaves;
morton becomes the only stored cell coordinate. This module is the
load-bearing replacement — the ratified gate for zagg's writer flip: NESTED
ids are derived exactly from the packed words via mortie's vectorized
mort2healpix, so Python consumers keep NESTED for free.
Order-24 seam (resolved per the final mortie spec §1/§4 — kind is carried
by the word encoding): NESTED ids above order 24 exceed the float64-exact
integer range (2**53), so JS/browser consumers cannot hold them
losslessly as Numbers. POINT-kind words (§1 suffix 48..=63 — an
order-29 location with no area claim) clip to order 24 for the NESTED view:
membership at a coarser level is ordinary truncation (§4), so nothing
labelled changes. Genuine AREA cells are NEVER clipped — coarsening an area
cell changes the labelled thing (that is aggregation, zagg D24) — so
fabrication of area cells above order 24 keeps the exact ids and warns
(see :data:FLOAT64_EXACT_MAX_ORDER).
fabricate_cell_ids(morton_words, *, level=None, _stacklevel=3)
Exact NESTED uint64 cell ids of packed morton words.
Pure function (mortie/numpy only): mort2healpix on the packed words.
The AREA words must share one order (mortie rejects mixed orders — fine
for hive stores, whose cell coordinates are single-order at the
manifest's cell_order). POINT-kind words (spec §1 suffix
48..=63) may ride alongside order-29 areas — mixed kinds are
well-formed per §4 — and clip to order
:data:FLOAT64_EXACT_MAX_ORDER for the NESTED view: a point has no
area claim, so coarser membership is ordinary truncation (§4), keeping
every fabricated id float64-exact. Area cells NEVER clip. Because
mortie's kernel takes one order per call, points (clipped to 24) and
areas fabricate separately and reassemble by position.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
morton_words
|
array - like
|
Packed |
required |
level
|
int
|
Expected HEALPix order of the words' ENCODING. When given it is
cross-checked against the order mortie derives from the area words
(and against 29 for point words — their encoded order, not the
clipped NESTED order) and a mismatch raises |
None
|
_stacklevel
|
int
|
Frame depth for the above-order-24 |
3
|
Returns:
| Type | Description |
|---|---|
ndarray
|
NESTED cell ids, |
Source code in src/moczarr/fabricate.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |