>>> import affine as affineA
>>> import affine as affineB
>>> affineA.EPSILON
1e-05
>>> affineB.EPSILON
1e-05
>>> instA = affineA.Affine(0.001215, 0.0, -120.9375, 0.0, -0.001215, 38.823)
>>> instA.is_degenerate
True
>>> affineA.set_epsilon(1e-20)
>>> instA.is_degenerate # doesn't change existing instances
True
>>> instB = affineB.Affine(0.001215, 0.0, -120.9375, 0.0, -0.001215, 38.823)
>>> instB.is_degenerate # but it does change new instances, even from different module names
False
>>> affineB.EPSILON
1e-20
>>> affineA.EPSILON
1e-20
Three thoughts
We should address this by making epsilon a property of the Affine class, not a global.
add a Affine.adjust_epsilon_assume_invertable() method as a convenience method to check for invertability and bump up the epsilon for that instance under the assumption that it is invertable. Similarly we could have a flag to turn off is_degenerate checks for an instance.
Would there be any harm in defaulting the EPSILON to a very low value like 1e-40?
The module-level global is problematic. As outlined here: https://github.com/mapbox/rasterio/issues/430#issuecomment-205857304
Three thoughts
Affine.adjust_epsilon_assume_invertable()
method as a convenience method to check for invertability and bump up the epsilon for that instance under the assumption that it is invertable. Similarly we could have a flag to turn off is_degenerate checks for an instance.1e-40
?