Skip to content

Commit

Permalink
relax morecantile dependency (#748)
Browse files Browse the repository at this point in the history
* relax morecantile dependency

* fix tests

* fix tests
  • Loading branch information
vincentsarago authored Oct 17, 2024
1 parent 60f6aad commit 0ee8dfb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@

* remove `minzoom` and `maxzoom` properties in `Info` model **breaking change**

* update `morecantile` dependency to allow `6.x` version

# 6.7.0 (2024-09-05)

* raise `MissingCRS` or `InvalidGeographicBounds` errors when Xarray datasets have wrong geographic metadata
Expand Down
4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ dependencies = [
"httpx",
"numexpr",
"numpy",
"morecantile>=5.0,<6.0",
"morecantile>=5.0,<7.0",
"pydantic~=2.0",
"pystac>=0.5.4",
"rasterio>=1.3.0",
Expand All @@ -45,6 +45,8 @@ test = [
"rioxarray",
# S3
"boto3",
# Some tests will fail with 5.0
"morecantile>=6.0,<7.0",
]

benchmark = [
Expand Down
27 changes: 17 additions & 10 deletions tests/test_io_rasterio.py
Original file line number Diff line number Diff line change
Expand Up @@ -895,9 +895,17 @@ def test_nonearthbody():
"""Reader should work with non-earth dataset."""
EUROPA_SPHERE = CRS.from_proj4("+proj=longlat +R=1560800 +no_defs")

with pytest.warns(UserWarning):
with Reader(COG_EUROPA) as src:
with Reader(COG_EUROPA) as src:
with pytest.warns(
UserWarning,
match="Cannot determine minzoom based on dataset information, will default to TMS minzoom.",
):
assert src.minzoom == 0

with pytest.warns(
UserWarning,
match="Cannot determine maxzoom based on dataset information, will default to TMS maxzoom.",
):
assert src.maxzoom == 24

# Warns because of zoom level in WebMercator can't be defined
Expand Down Expand Up @@ -926,13 +934,12 @@ def test_nonearthbody():
lat = (src.bounds[1] + src.bounds[3]) / 2
assert src.point(lon, lat, coord_crs=src.crs).data[0] is not None

with pytest.warns(UserWarning):
europa_crs = CRS.from_authority("ESRI", 104915)
tms = TileMatrixSet.custom(
crs=europa_crs,
extent=europa_crs.area_of_use.bounds,
matrix_scale=[2, 1],
)
europa_crs = CRS.from_authority("ESRI", 104915)
tms = TileMatrixSet.custom(
crs=europa_crs,
extent=europa_crs.area_of_use.bounds,
matrix_scale=[2, 1],
)

with Reader(COG_EUROPA, tms=tms) as src:
assert src.info()
Expand Down Expand Up @@ -966,11 +973,11 @@ def test_nonearth_custom():
MARS_MERCATOR,
extent_crs=MARS2000_SPHERE,
title="Web Mercator Mars",
geographic_crs=MARS2000_SPHERE,
)

with Reader(COG_MARS, tms=mars_tms) as src:
assert src.get_geographic_bounds(MARS2000_SPHERE)[0] > -180
assert src.get_geographic_bounds(mars_tms.rasterio_geographic_crs)[0] > -180


def test_tms_tilesize_and_zoom():
Expand Down

0 comments on commit 0ee8dfb

Please sign in to comment.