BinGridCorners

class geodetic_engine.bingrid.BinGridCorners[source]

Bases: object

The four corners A, B, C and D of a bin grid, labelled by their numbers.

Build with from_corners(), which takes the corners in any order.

a

(min inline, min crossline).

b

(min inline, max crossline).

c

(max inline, min crossline).

d

(max inline, max crossline).

Raises:

InvalidCornersError – On construction, if the corners’ numbers are not those of A, B, C and D.

classmethod from_corners(corners)[source]

Label four corners given in any order.

Parameters:

corners (Iterable[BinGridCorner | tuple[int, int, float, float]]) – Exactly four corners, each a BinGridCorner or an (inline, crossline, easting, northing) tuple.

Return type:

BinGridCorners

Returns:

The corners as A, B, C and D.

Raises:

InvalidCornersError – If there are not exactly four, or their inline and crossline numbers are not two distinct values each in all four combinations.

labelled()[source]

The corners with their labels, in order A, B, C, D.

Return type:

tuple[tuple[str, BinGridCorner], ...]

property inline_range: tuple[int, int]

Minimum and maximum inline number.

property crossline_range: tuple[int, int]

Minimum and maximum crossline number.

property coordinates: NDArray[float64]

Coordinates of A, B, C and D as an array of shape (4, 2).

property numbers: NDArray[float64]

Inline and crossline numbers of A, B, C and D, shape (4, 2).

with_coordinates(coordinates)[source]

The same corners at other coordinates.

Parameters:

coordinates (Iterable[Iterable[float]]) – Four (easting, northing) pairs, in order A, B, C, D.

Return type:

BinGridCorners

Returns:

Corners with these coordinates and the same numbers.

to_json_dict()[source]

Render the corners as plain data, labelled, in order A, B, C, D.

Return type:

list[dict[str, Any]]

__init__(a, b, c, d)