match_bin_grid

geodetic_engine.bingrid.matching.match_bin_grid(corners, crs, grids, *, increment_i=1, increment_j=1)[source]

Find the stored grids a dataset is on, by the SDU note’s algorithm.

Parameters:
  • corners (BinGridCorners | Iterable[BinGridCorner | tuple[int, int, float, float]]) – The dataset’s four corners, in any order, numbered as on the grid it was loaded from.

  • crs (Any) – The dataset’s projected CRS; preferably the one it was binned in.

  • grids (Iterable[StoredBinGrid]) – The stored grids to search.

  • increment_i (int, default: 1) – Inline increment at which the dataset’s traces were loaded.

  • increment_j (int, default: 1) – Crossline increment at which they were loaded.

Return type:

MatchResult

Returns:

The matching grids, best first; MatchResult.best is the one to assign, or None when the dataset needs a grid of its own.

Raises:

Example

>>> from geodetic_engine.bingrid import Handedness, corners_from_p6
>>> parameters = P6Parameters(
...     origin_i=1, origin_j=1,
...     origin_easting=423081.91, origin_northing=3227689.59,
...     bin_width_i=30.0, bin_width_j=25.0, bearing_j=2.48019694,
...     handedness=Handedness.RIGHT,
... )
>>> store = [StoredBinGrid("survey-1", parameters, "EPSG:26715")]
>>> corners = corners_from_p6(
...     parameters, inline_range=(101, 201), crossline_range=(51, 151)
... )
>>> match_bin_grid(corners, "EPSG:26715", store).best.grid.key
'survey-1'