P6Parameters

class geodetic_engine.bingrid.P6Parameters[source]

Bases: object

A bin grid as the parameters of EPSG method 9666 or 1049.

origin_i

Inline number of the origin bin node.

origin_j

Crossline number of the origin bin node.

origin_easting

Map grid easting of the origin bin node.

origin_northing

Map grid northing of the origin bin node.

bin_width_i

Distance between adjacent bin nodes along the I-axis, as a ground distance in the CRS’s linear unit.

bin_width_j

Distance between adjacent bin nodes along the J-axis.

bearing_j

Map grid bearing of the J-axis, clockwise from grid north, in degrees, normalised to [0, 360).

handedness

Whether the I-axis is 90 degrees clockwise (right-handed) or counterclockwise (left-handed) from the J-axis.

scale_factor

Bin grid scale factor k: map grid distance per ground distance at the grid. 1 when the grid was designed on the map grid.

increment_i

Change of the inline number between adjacent bin nodes.

increment_j

Change of the crossline number between adjacent bin nodes.

Raises:

InvalidParameterError – On construction, if a value is outside its domain (see the attribute descriptions).

Example

>>> grid = P6Parameters(
...     origin_i=1, origin_j=1,
...     origin_easting=456781.0, origin_northing=5836723.0,
...     bin_width_i=25.0, bin_width_j=12.5, bearing_j=20.0,
...     handedness=Handedness.RIGHT, scale_factor=0.99984,
... )
>>> grid.to_map(300, 247).round(2)
array([[ 464855.62, 5837055.9 ]])
property method_code: int

EPSG coordinate operation method code, 9666 or 1049.

property bearing_i: float

Map grid bearing of the I-axis, in degrees in [0, 360).

property grid_step_i: float

Map grid distance per unit of inline number, k dI / incI.

property grid_step_j: float

Map grid distance per unit of crossline number, k dJ / incJ.

to_map(i, j=None)[source]

Map grid coordinates of bin grid positions.

Parameters:
  • i (Iterable[Iterable[float]] | Iterable[float] | float) – Either every position in one go – one (inline, crossline) pair given flat, a sequence of pairs, or an array of shape (n, 2) – when j is omitted; or the inline numbers, as a scalar or a sequence, when j is given.

  • j (Iterable[float] | float | None, default: None) – Crossline numbers, matching i.

Return type:

NDArray[double]

Returns:

Array of shape (n, 2) – easting and northing per position.

to_bin(easting, northing=None)[source]

Bin grid positions of map grid coordinates.

Parameters:
  • easting (Iterable[Iterable[float]] | Iterable[float] | float) – Either every point in one go – one (easting, northing) pair given flat, a sequence of pairs, or an array of shape (n, 2) – when northing is omitted; or the eastings, as a scalar or a sequence, when it is given.

  • northing (Iterable[float] | float | None, default: None) – Northings, matching easting.

Return type:

NDArray[double]

Returns:

Array of shape (n, 2) – fractional inline and crossline numbers.

reanchored(i, j)[source]

The same grid with its origin moved to another bin node.

Parameters:
  • i (float) – Inline number of the new origin.

  • j (float) – Crossline number of the new origin.

Return type:

P6Parameters

Returns:

Parameters that map every position exactly as these do.

to_json_dict()[source]

Render the parameters as plain data.

Return type:

dict[str, Any]

Returns:

Every attribute, with the method code and both axis bearings.

__init__(origin_i, origin_j, origin_easting, origin_northing, bin_width_i, bin_width_j, bearing_j, handedness, scale_factor=1.0, increment_i=1, increment_j=1)