def test_rgb_msk_int(): with rasterio.open('/tmp/rgb_msk_internal.tif') as src: assert np.array_equal(read_mask(src), msk)
def test_rgba_msk(): with rasterio.open('/tmp/rgba_msk.tif') as src: # mask takes precendent over alpha assert np.array_equal(read_mask(src), msk)
def test_rgba_ndv(): with rasterio.open('/tmp/rgba_ndv.tif') as src: assert np.array_equal(read_mask(src), alp)
def test_rgb_msk(): with rasterio.open('/tmp/rgb_msk.tif') as src: assert np.array_equal(read_mask(src), msk) # each band's mask is also equal for bmask in src.read_masks(): assert np.array_equal(bmask, msk)
def test_rgba_ndv(): with rasterio.open('/tmp/rgba_ndv.tif') as src: with pytest.warns(NodataShadowWarning): assert np.array_equal(read_mask(src), alp)