itacart.boundary.is_valid_cell

itacart.boundary.is_valid_cell(cell)[source]

Whether a cell exists in the ITACaRT domain.

Stricter than itacart.index.is_valid_index(), which only checks syntax. This additionally applies:

  • the western-quadrant X = 0 non-existence rule,

  • the prefix-only status of column 2004,

  • the resolution-1 extent bounds per quadrant,

  • antemeridian coverage, so oceanic cells beyond 180 degrees outside an extension zone are rejected.

Column 2004 stands one past Table 1 and the grammar admits it only so that the fifth child of a trapezoidal cell of column 2003 can be spelled. It is a prefix, never a resolution-1 cell of its own, so this predicate refuses it at resolution 1 and accepts it deeper.

The extent bounds and antemeridian coverage are one test: a cell exists when its ring still has area after the clip. The index space of resolution 1 is not a rectangle, and no bound of the form X <= 2003 describes it. The greatest addressable column shrinks with the cosine of the latitude, from 2003 on the equator to 313 in row 900 and none at all in the polar row. RES1_MAX_INDEX transcribes Table 1 faithfully but names the corner of a bounding box, not the last cell of any row.

A ring must also close without crossing itself. Absorbing a border steeper than the lattice shear can fold the quadrilateral it builds, and the shoelace area of a folded ring is the difference of its two lobes rather than nothing, so an area test alone accepts it. Measured: NE(0000/1000(3(A1))) reports 104 724.4 square metres from a ring that covers 322 621.8 once repaired, and it was accepted here. It is refused instead, and not repaired: a fold is an artefact of absorption and the cell it would name has no boundary anyone drew.

A syntactically malformed index is answered False rather than raised on, so the predicate composes.

Parameters:

cell (str) – Compositional index string.

Return type:

bool | list[bool]

Returns:

A boolean for a single cell, or a positionally aligned list.