odc.geo.math.snap_affine

odc.geo.math.snap_affine(A, ttol=0.001, stol=1e-06, tol=1e-08)[source]

Snap scale and translation parts to integer when close enough.

When scale is less than 1 then attempt snapping to 1/<int>.

If input has rotation/shear component then return unchanged.

Parameters:
  • A (Affine) – Affine matrix

  • ttol (float) – translation tolerance, defaults to 1e-3

  • stol (float) – scale tolerance, defaults to 1e-6

  • tol (float) – rotation tolerance, defaults to 1e-10

Return type:

Affine

Returns:

Adjusted Affine matrix.

Returns:

Input Affine matrix when rotation/shear is present.