Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions rio_tiler/experimental/_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,8 @@ async def part( # noqa: C901
rasterio_win = window_from_bounds(*dst_bounds, transform=dataset.transform)
row_off = math.floor(rasterio_win.row_off)
col_off = math.floor(rasterio_win.col_off)
win_width = math.ceil(rasterio_win.width)
win_height = math.ceil(rasterio_win.height)
win_width = math.ceil(rasterio_win.width) + 1
win_height = math.ceil(rasterio_win.height) + 1

# TODO: add `minimum_overlap` like in reader.part method
col_end = min(dataset.width, math.ceil(rasterio_win.col_off + rasterio_win.width))
Expand Down Expand Up @@ -882,11 +882,11 @@ def warp(
destination,
src_transform=img.transform,
src_crs=img.crs,
dst_transform=dst_transform,
dst_crs=dst_crs,
resampling=Resampling[reproject_method],
src_nodata=img.nodata,
dst_crs=dst_crs,
dst_transform=dst_transform,
dst_nodata=img.nodata,
resampling=Resampling[reproject_method],
)

# rasterio doesn't handle masked arrays really well
Expand Down
15 changes: 9 additions & 6 deletions tests/test_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,10 @@ async def test_async_reader_tile(src_path):
tile = await src.tile(x, y, zoom)
sync_tile = sync_src.tile(x, y, zoom)
assert tile.bounds == sync_tile.bounds
numpy.testing.assert_almost_equal(sync_tile.array, tile.array)
numpy.testing.assert_array_equal(sync_tile.array, tile.array)
numpy.testing.assert_array_equal(
sync_tile.array.mask, tile.array.mask
)
except TileOutsideBounds:
pass

Expand All @@ -394,22 +397,22 @@ async def test_async_reader_part():
img = await src.part(bbox)
sync_img = sync_src.part(bbox)
assert img.bounds == sync_img.bounds
numpy.testing.assert_almost_equal(sync_img.array, img.array)
numpy.testing.assert_array_equal(sync_img.array, img.array)

img = await src.part(bbox, dst_crs=src.crs)
sync_img = sync_src.part(bbox, dst_crs=sync_src.crs)
assert img.bounds == sync_img.bounds
numpy.testing.assert_almost_equal(sync_img.array, img.array)
numpy.testing.assert_array_equal(sync_img.array, img.array)

img = await src.part(bbox, dst_crs="EPSG:3857")
sync_img = sync_src.part(bbox, dst_crs="EPSG:3857")
assert img.bounds == sync_img.bounds
numpy.testing.assert_almost_equal(sync_img.array, img.array)
numpy.testing.assert_array_equal(sync_img.array, img.array)

img = await src.part(bbox, max_size=20)
sync_img = sync_src.part(bbox, max_size=20)
assert img.bounds == sync_img.bounds
numpy.testing.assert_almost_equal(sync_img.array, img.array)
numpy.testing.assert_array_equal(sync_img.array, img.array)

img = await src.part(bbox, width=20, height=10)
sync_img = sync_src.part(bbox, width=20, height=10)
Expand All @@ -429,7 +432,7 @@ async def test_async_reader_part():
sync_img = sync_src.part(bbox, dst_crs=sync_src.crs)
# This test fails on github CI
# assert img.bounds == sync_img.bounds
numpy.testing.assert_almost_equal(sync_img.array, img.array)
numpy.testing.assert_array_equal(sync_img.array, img.array)

# TODO: this test fails because the output shape is different
# img = await src.part(bbox, dst_crs="epsg:4326", max_size=1000)
Expand Down