A recent change in odc-geo (link here) is causing our tests to fail against odc-geo version 0.4.7, due to tiny differences in coordinate certainty causing comparisons like this to fail:
ds.odc.geobox == ds2.odc.geobox
This PR implements a temporary workaround using a new geobox_test testing function that compares GeoBoxes using np.allclose to account for tiny differences in coordinate precision. This should be reverted if an odc-geo fix/workaround becomes available.
def geobox_test(gbox1, gbox2):
"""
Tests equivalency between two GeoBoxes, allowing for floating
point precision differences between coordinates
TODO: Remove once `odc-geo` bug is resolved
"""
y_dim, x_dim = gbox1.dims
assert np.allclose(gbox1.coords[x_dim].values, gbox2.coords[x_dim].values)
assert np.allclose(gbox1.coords[y_dim].values, gbox2.coords[y_dim].values)
assert np.allclose(gbox1.resolution.xy, gbox2.resolution.xy)
assert gbox1.crs == gbox2.crs
assert gbox1.shape == gbox2.shape
Proposed changes
A recent change in
odc-geo
(link here) is causing our tests to fail againstodc-geo
version 0.4.7, due to tiny differences in coordinate certainty causing comparisons like this to fail:This PR implements a temporary workaround using a new
geobox_test
testing function that compares GeoBoxes usingnp.allclose
to account for tiny differences in coordinate precision. This should be reverted if anodc-geo
fix/workaround becomes available.