Select and reproduce an operation for a region#
Select an operation for the survey’s source and target coordinate reference systems (CRSs) and its extent, then save the selection so a later run can verify and reuse it. Give the extent in west, south, east, north order in degrees. Supply a local grid-resource directory if the operation needs one, or an authority or candidate pin if the survey specifies the operation. Preserve any CRS definition epoch consistently. It applies to every row.
Select and check a control#
This candidate selects an operation from EPSG:4326 to EPSG:32631 for an extent around the equator. It prints the selection and axis convention alongside a control transformed before and after reload.
import numpy as np
from cugeo.proj import Resolution, Transformer
longitude = np.array([3.0])
latitude = np.array([0.0])
with Resolution.resolve(
"EPSG:4326",
"EPSG:32631",
area_of_interest=(2, -1, 4, 1),
) as resolution:
print("selection:", resolution.explain())
with Transformer.from_resolution(resolution, always_xy=True) as transformer:
record = transformer.to_record()
x, y, status = transformer.transform(longitude, latitude, return_status=True)
print("original operation:", transformer.explain())
print("original axis mode:", record["always_xy"])
print("original coordinates and status:", x[0], y[0], status[0])
with Transformer.from_record(record) as reloaded:
x, y, status = reloaded.transform(longitude, latitude, return_status=True)
print("reloaded operation:", reloaded.explain())
print("recorded axis mode:", record["always_xy"])
print("reloaded coordinates and status:", x[0], y[0], status[0])
Check that both runs report the same selection and an OK row near (500000, 0) metres. The record specifies longitude-first axis order. Keep the to_record() result with the survey’s inputs for a later run. Verified reload checks the instantiated CRS definitions and any required grid identity. If you need to identify the stages prepared for execution, inspect prepared_explain() on the transformer.
Apply the selection to the survey#
Replace the candidate CRSs and extent with the survey’s values. The control checks agreement at that point. A prepared single choice can refuse a row outside its pick_region. On supported routes, row_choice describes per-row selection. Candidate area metadata alone cannot predict whether an individual row will be accepted.
If the extended survey produces a refusal, use the exception or row status to diagnose the refused transform or failed coordinate.