Skip to content

Public decimal→word parse API to mirror the 0.9.0 emit surface, before the 1.x freeze #114

Description

@espg

Ask: export a public, numpy-only parse counterpart to the decimal emit surface added for #104 — e.g. a scalar mortie.decimal_to_word(s) (and optionally a vectorized inverse of to_decimal) — ideally before the 1.x spec freeze (#48 / #62), since downstream code is starting to depend on it.

Context: zagg adopted decimal morton strings as the external/path form for shard ids (englacial/zagg#199, PR englacial/zagg#205), per the frozen convention. The emit direction is fully public in 0.9.0: decimal_repr() (mortie/morton_index.py:500), to_decimal() (:514), hive_path() (:548). The parse direction is not:

  • _decimal_to_word (:35) does exactly the right thing — scalar, numpy-only, raises on malformed input — but is private, so zagg's parse boundary (zagg.grids.morton.morton_word) currently reaches into mortie.morton_index._decimal_to_word, which will break silently on any internal rename.
  • The public alternative, MortonIndexArray.from_hive_path (:570), is a path-parsing classmethod on the pandas ExtensionArray: using it as a scalar decimal→word parse means a pandas import and ExtensionArray construction per call, in hot paths (per-shard key parsing) that are otherwise pure numpy.

Round-trip symmetry (word → decimal → word) is now load-bearing downstream — zarr store leaf paths, status-channel keys, and CLI shard selection in zagg all parse decimal ids back to packed words.

Small doc rider: while exporting, it would be worth documenting the order-29 point/area non-injectivity caveat on the parse side (surfaced during review of englacial/zagg#205) so parse-side users know decimal ids at the terminal order don't distinguish the two.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions