zenith, azimuth → row, col.
A sparse set of valid sky points is sampled over the image and enriched with
their angular coordinates. Two local least-squares surfaces
(spatial::surf.ls, np = 6) are fitted to predict row and col as
smooth functions of (azimuth, zenith). Predictions are rounded to the
nearest integer index. Out-of-bounds indices are not produced under normal
conditions; clamp externally if needed.
row, col → zenith, azimuth.
Angles are obtained by direct lookup on z and a using
terra::cellFromRowCol. If any queried cell is NA (e.g., outside the
calibrated lens footprint), a synthetic z is reconstructed from the lens
model attached to z (attribute lens_coef), and a is rebuilt with
azimuth_image() using the stored orientation attribute in a. This yields
robust angle retrieval near borders.