Cell Identifiers¶
A cell can be named in several ways. Each names a cell only together with
its grid: the same identifier names different cells in grids with a
different N_side or different polar squares, so data exchanged by
identifier should say which grid it uses, by its
codespace, the
uri of the registered grid or
the one a grid is constructed with, which should resolve to the grid’s
to_dggrs_definition(). The
rHEALPix DGGRS that OGC registers
(OGC rHEALPix,
the preset WGS84_003_OGC) declares two of them as its identifiers.
The grammar of the index strings is in the conformance chapter.
Representations¶
Representation |
Example ( |
Notes |
|---|---|---|
Index string |
|
A face letter and one digit per resolution, up to
|
suid |
|
The same as a tuple. Every grid has one. |
Position |
|
Level, row and column among all cells of that level in the planar grid, counted from the top left. |
uint64 |
|
The position packed as |
Level-row-col text |
|
The position in hexadecimal, the text form of OGC 2D tile matrix sets. OGC rHEALPix does not declare it as an identifier. |
Converting between them¶
For one cell, each representation is an attribute of the
Cell, and the grid builds the cell back:
Representation |
From a cell |
To a cell |
|---|---|---|
Index string |
|
|
suid |
|
|
Position |
||
uint64 |
||
Level-row-col text |
For many cells, the grid converts arrays without building cells, in under a microsecond per cell for the integer forms. Positions are the hub, three int64 arrays of level, row and column:
index strings and positions:
level_row_col_from_indices(),indices_from_level_row_col();positions and uint64, which every grid supports:
uint64_from_level_row_col(),level_row_col_from_uint64();index strings and uint64 directly:
uint64_from_indices(),indices_from_uint64();index strings and level-row-col text:
level_row_col_text_from_indices(),indices_from_level_row_col_text();positions to nuclei, in the plane, on the ellipsoid or on the authalic sphere:
nuclei_from_level_row_col(), the counterpart ofnuclei()for index strings.
rhp_to_uint64() and
rhp_from_uint64() convert single index
strings, returning None for invalid input like the other wrappers.
Sub-zone orders¶
Data laid out by position rather than by identifier, as in OGC API - DGGS
and DGGS-JSON, depends on the order of a cell’s subcells. The orders take
their names from OGC’s DGGRS definitions: "mortonCurve" (the order of
the digits), "scanline" (rows across the whole cell), "hilbertCurve"
(N_side a power of 2) and "spiralFromCenter" (odd N_side).
Each grid declares one order, given by
sub_zone_order: OGC rHEALPix
declares "scanline", and other grids use "mortonCurve". That order
is the default of subcells(),
sub_zone_index() (a cell’s position among an
ancestor’s subcells) and sub_zone_at() (the
subcell at a position).
The identifiers module¶
Cell identifiers of an rHEALPix grid and the arithmetic behind them: index
strings, the orders of a cell’s subcells, a cell’s level, row and column in
the planar grid, and the uint64 and level-row-col text forms of that
position. All of it depends only on a grid’s layout (N_side, the polar
squares and max_resolution), not on its ellipsoid or projection. The
supported API is the RHEALPixDGGS and Cell methods built on it.
- rhealpixdggs.identifiers.CELLS0 = ['N', 'O', 'P', 'Q', 'R', 'S']¶
The resolution 0 cells, the faces of the cube, which begin every identifier.
- rhealpixdggs.identifiers.INDEX_STRING_N_SIDES = (2, 3)¶
The
N_sidevalues whose grids have index strings (issue #146).