-
Notifications
You must be signed in to change notification settings - Fork 551
Closed
Description
OSGeo/gdal#11713 (comment) reports trouble with OSGeo/gdal@6074ce4
The warp test is definitely brittle. I expect similar to happen again in the future.
assert 1314520 == 1309625
+ where 1314520 = <function count_nonzero at 0x3217fdd4b2b0>(array([14, 17, 11, ..., 42, 43, 45], shape=(1315638,), dtype=uint8))
+ where <function count_nonzero at 0x3217fdd4b2b0> = np.count_nonzero
test3d = True, count_nonzero = 1309625
path_rgb_byte_tif = 'data/RGB.byte.tif'
@pytest.mark.parametrize("test3d,count_nonzero", [(True, 1309625), (False, 437686)])
def test_reproject_array_interface(test3d, count_nonzero, path_rgb_byte_tif):
class DataArray:
def __init__(self, data):
self.data = data
def __array__(self, dtype=None):
return self.data
@property
def dtype(self):
return self.data.dtype
with rasterio.open(path_rgb_byte_tif) as src:
if test3d:
source = DataArray(src.read())
else:
source = DataArray(src.read(1))
out = DataArray(np.empty(source.data.shape, dtype=np.uint8))
reproject(
source,
out,
src_transform=src.transform,
src_crs=src.crs,
src_nodata=src.nodata,
dst_transform=DST_TRANSFORM,
dst_crs="EPSG:3857",
dst_nodata=99,
)
assert isinstance(out, DataArray)
> assert np.count_nonzero(out.data[out.data != 99]) == count_nonzero
E assert 1314520 == 1309625
E + where 1314520 = <function count_nonzero at 0x3217fdd4b2b0>(array([14, 17, 11, ..., 42, 43, 45], shape=(1315638,), dtype=uint8))
E + where <function count_nonzero at 0x3217fdd4b2b0> = np.count_nonzero
Reactions are currently unavailable