itacart.cells

Quantization and inverse geometry: the core address <-> position mapping.

Satisfies OGC DGGS Core requirements 11 (simple cell geometry), 12 (direct position) and 16 (quantization).

Provenance: itacart_core/cells.py, plus the notebook’s sinusoidal_coordinates_to_dggs.

The shear

ITACaRT cells are 45-degree parallelograms on the parallels plane, not axis-aligned squares. For a lower-left vertex (x, y) and side l the vertices are (x, y), (x + l, y), (x, y + l) and (x - l, y + l) (paper, section 3, Figure 1).

A unit shear maps that tiling onto a square lattice:

u = |x| + |y|      v = |y|        forward, Jacobian 1
|x| = u - v        |y| = v        inverse

All indexing arithmetic – the 2x2 and 5x5 subdivisions – happens in (u, v), where it is ordinary integer flooring. This is the single idea the whole module rests on, and it is what keeps the descent free of trigonometry below resolution 1.

The base index reported at resolution 1 is X = u_col - Y and Y = j, so X is the distance from the cell’s anchor to the prime meridian along the parallel, in 10 km units, and the anchor recovers as x = X * l. That is what makes the paper’s neighbour rules hold (section 3.1): the northern neighbour keeps X, the eastern one keeps Y.

Boundary scope

Positions on the prime-meridian triangles, the border-absorbing cells, the polar row, the two caps and the extension zones all quantize. A position in the strip between the last lattice column and the domain border is carried into the cell that absorbs the strip; inside the meridian column the carry reaches the triangle descent too, and where the meridian cell is the only one left in a fine row the position is carried onto the meridian. That the answer exists is measured, not proven: every answer over the lattices the test suite enumerates, both caps at every resolution included, is confirmed by itacart.boundary.is_valid_cell().

A known limitation. Those lattices miss an exception. Inside the cell that holds a pole at resolution 10 – NE(0000/1000(1(B2(4(E5(4(B2(4(A1(4)))))))))) at the north pole and its twin under SE at the south – the answer at resolutions 11 and 12 can be a spelling that names no cell: one that itacart.boundary.is_valid_cell() denies, and that the functions taking a cell then refuse. Four positions are known to be answered so, at longitude +/-155.0390625 and latitude +/-89.99999962902984, at both resolutions; at (155.0390625, 89.99999962902984) and resolution 11 the answer is NE(0000/1000(1(B2(4(E5(4(B2(4(A1(4(B4))))))))))). Every name that addresses a position inherits it, and a named test pins the four answers, so that it fails when this is fixed. The same cell is not refined either, as itacart.hierarchy states.

Module constants

FLOOR_EPSILON_M

Floor tolerance, in metres, applied wherever a coordinate meets a grid line.

Functions

cell_to_anchor

Anchor of a cell: the vertex its index literally encodes.

cell_to_boundary

Geodetic vertices bounding a cell, counter-clockwise.

cell_to_centroid

Geodetic centroid of a cell, which is its representative position.

cell_to_polygon

Cell boundary as a Shapely polygon in EPSG:4326.

cell_to_sinusoidal

Anchor of a cell on the projection plane.

geo_to_cell

Address the cell containing a geodetic position.

is_quadrant_boundary_cell

Whether a cell's anchor is shared with a cell in another quadrant.

sinusoidal_to_cell

Address a cell from projection-plane coordinates.