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:
- Returns:
The matching grids, best first;
MatchResult.bestis the one to assign, or None when the dataset needs a grid of its own.- Raises:
InvalidCornersError – If the corners are not those of a bin grid, or their spans are not multiples of the increments.
DegenerateBinGridError – If their coordinates cannot be.
InvalidParameterError – If an increment is not a positive integer.
geodetic_engine.bingrid.UnsupportedCRSError – If the dataset’s CRS cannot carry a bin grid.
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'