itacart.engine.ITACaRT

class itacart.engine.ITACaRT(default_resolution=13, edge_model='WGS84_GEODESIC', max_segment_m=DEFAULT_MAX_SEGMENT_M)[source]

Bases: object

Stateful facade over the ITACaRT reference system.

Wraps the functional API so a caller can fix defaults once and reuse them, and provides the descriptive metadata the OGC model asks for.

Parameters:
  • default_resolution (int, default: 13) – Resolution assumed when a call omits one.

  • edge_model (str, default: "WGS84_GEODESIC") – Default edge interpretation for geometry operations.

  • max_segment_m (float, default: DEFAULT_MAX_SEGMENT_M) – Default densification bound in metres.

Raises:
  • ResolutionError – If default_resolution is outside the table.

  • ValueError – If edge_model is not an edge type ITACaRT defines, or max_segment_m is not positive.

EDGE_MODELS = ('WGS84_GEODESIC', 'WGS84_SMALL_CIRCLE')

Edge types this reference system declares, in the vocabulary of clause 9.1.4.2 of the standard. ITACaRT states two: its cell edges are geodesics on the WGS84 ellipsoid, and the rows and the polar cap close on small circles of constant latitude.

describe()[source]

Machine-readable description of the reference system.

Covers identity and DOI, the CRS and datum, the tessellation method, cell geometry, the full resolution table, refinement ratios, and the boundary treatments. Shaped to feed an OGC API-DGGS /dggs/{dggrsId} response.

The content is read from the package rather than restated: the resolution table comes from itacart.resolution_table(), which transcribes Table 1 of the paper, and the ellipsoid from itacart.constants, which transcribes section 3. Anything here that duplicated a value instead of reading it would be a second place for that value to be wrong.

constraints carries cellEqualSized, which Requirement 21 asks the reference system to declare, alongside the exception that makes the declaration honest.

Return type:

dict[str, Any]

Returns:

The description as a plain mapping.

crs()[source]

The coordinate reference system this grid is defined on.

Reports WGS84 as the datum, satisfying requirement 7 and the GNSS-compatibility design criterion, alongside the ellipsoidal sinusoidal projection used internally.

The ellipsoid parameters are read from itacart.constants, which transcribes section 3 of the paper and derives everything from the two defining parameters rather than transcribing decimals.

Return type:

dict[str, Any]

Returns:

A mapping with datum, ellipsoid parameters, the PROJ string and the projection’s defining equations.

conformance()[source]

Self-reported conformance against DGGS Core and EAERS.

Reports one record per requirement of OGC 20-040r3, each with its URI, a boolean verdict, a coverage description and a justification.

The verdict is boolean because the requirements are written with shall, which admits no middle answer: a requirement that holds for every cell but three is not met. Coverage is reported beside it and never instead of it, because the size of an exception is information a consumer needs and is not a softening of the verdict. Where a requirement is not met, the justification names what diverges and, wherever the package has measured it, by how much and over how many cells.

Three things this deliberately does not do. It does not repeat the paper’s grouping of Requirements 22 to 25 under one heading and one verdict: the figures of the standard put a polyhedron in the path of all four, but the normative text puts it in the path of only the first, and the other three are met. It does not write any limitation of an algorithm as a property of the grid: where a refusal belongs to an operation rather than to the tessellation, the record says which. And it does not answer a requirement about the figure on the surface of the Earth by measuring the chart the package happens to draw it in, which is how the polar caps were once read out of Requirements 11 and 26 that they in fact meet.

Return type:

dict[str, Any]

Returns:

A mapping with the two conformance classes and, under requirements, one record per requirement, each with an identifier, a status and a justification.

geo_to_cell(lon, lat, resolution=None)[source]

Address the cell containing a position.

See itacart.cells.geo_to_cell().

Parameters:
Return type:

str

cell_to_centroid(cell)[source]

Geodetic centroid of a cell.

See itacart.cells.cell_to_centroid().

Raises:

NonAtomicIndexError – If the index names more than one cell. The functional API answers a compositional index with a positionally aligned list; this signature promises one answer, and returning the first of several would be wrong in a way the type checker endorses. The refusal uses the package’s own exception rather than a bare one, because are_neighbor_cells and grid_distance refuse the identical argument shape with this exception and a caller should not have to know which of the three it called.

Parameters:

cell (str)

Return type:

tuple[float, float]

NonExistentCellError: If any cell of the index names no cell.

The predicate is the arbiter and the contract ends there: a spelling it denies is refused rather than answered for the cell it would otherwise fold onto.

Parameters:

cell (str)

Return type:

tuple[float, float]

cell_to_boundary(cell)[source]

Geodetic vertices bounding a cell.

See itacart.cells.cell_to_boundary().

Raises:

NonAtomicIndexError – If the index names more than one cell, for the reason given on cell_to_centroid().

Parameters:

cell (str)

Return type:

list[tuple[float, float]]

NonExistentCellError: If any cell of the index names no cell.

The predicate is the arbiter and the contract ends there: a spelling it denies is refused rather than answered for the cell it would otherwise fold onto.

Parameters:

cell (str)

Return type:

list[tuple[float, float]]