Skip to content

Commit

Permalink
Error message should match x, y, z arguments (#712)
Browse files Browse the repository at this point in the history
* Error message should match x, y, z arguments

* Update xarray.py

* lint

* change other readers

* update changelog

---------

Co-authored-by: vincentsarago <[email protected]>
  • Loading branch information
abarciauskas-bgse and vincentsarago authored Jun 7, 2024
1 parent 91095a2 commit f59532a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# unreleased

* better error message for `TileOutsideBounds` errors (author @abarciauskas-bgse, https://github.com/cogeotiff/rio-tiler/pull/712)

# 6.6.1 (2024-05-17)

* fix/support `scale/offset` indexes selection (author @jddeal, https://github.com/cogeotiff/rio-tiler/pull/709)
Expand Down
4 changes: 2 additions & 2 deletions rio_tiler/io/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ def tile(
"""
if not self.tile_exists(tile_x, tile_y, tile_z):
raise TileOutsideBounds(
f"Tile {tile_z}/{tile_x}/{tile_y} is outside image bounds"
f"Tile(x={tile_x}, y={tile_y}, z={tile_z}) is outside bounds"
)

if isinstance(assets, str):
Expand Down Expand Up @@ -1036,7 +1036,7 @@ def tile(
"""
if not self.tile_exists(tile_x, tile_y, tile_z):
raise TileOutsideBounds(
f"Tile {tile_z}/{tile_x}/{tile_y} is outside image bounds"
f"Tile(x={tile_x}, y={tile_y}, z={tile_z}) is outside bounds"
)

if isinstance(bands, str):
Expand Down
2 changes: 1 addition & 1 deletion rio_tiler/io/rasterio.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def tile(
"""
if not self.tile_exists(tile_x, tile_y, tile_z):
raise TileOutsideBounds(
f"Tile {tile_z}/{tile_x}/{tile_y} is outside {self.input} bounds"
f"Tile(x={tile_x}, y={tile_y}, z={tile_z}) is outside bounds"
)

tile_bounds = self.tms.xy_bounds(Tile(x=tile_x, y=tile_y, z=tile_z))
Expand Down
4 changes: 3 additions & 1 deletion rio_tiler/io/xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,9 @@ def tile(
reproject_method = resampling_method

if not self.tile_exists(tile_x, tile_y, tile_z):
raise TileOutsideBounds(f"Tile {tile_z}/{tile_x}/{tile_y} is outside bounds")
raise TileOutsideBounds(
f"Tile(x={tile_x}, y={tile_y}, z={tile_z}) is outside bounds"
)

ds = self.input
if nodata is not None:
Expand Down

0 comments on commit f59532a

Please sign in to comment.