From 9d803559ecdf9fdd31e1c8408a7792e0975e8d79 Mon Sep 17 00:00:00 2001 From: Jack Dunn Date: Mon, 4 Nov 2024 06:16:14 -0500 Subject: [PATCH] rio-tiler v7 compatibility --- CHANGES.md | 6 ++++++ pyproject.toml | 2 +- rio_tiler_pds/copernicus/aws/dem.py | 6 +++--- tests/test_copernicus_dem.py | 15 +++++++++------ 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 3af556f..dc5912a 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,5 +1,11 @@ # Release Notes +## 0.11.0 (TBD) + +* update rio-tiler requirement to `>=7.0,<8.0` +* replace `geographic bounds` with dataset bounds in `Reader.info()` method's response **breaking change** +* remove `minzoom` and `maxzoom` properties in `Info` model **breaking change** + ## 0.10.1 (2023-08-21) * calculate scene bounds from multipolygons for Sentinel-1 diff --git a/pyproject.toml b/pyproject.toml index 977e7b7..5df9fe0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,7 +20,7 @@ classifiers = [ "Typing :: Typed", ] dynamic = ["version"] -dependencies = ["rio-tiler>=5.0,<7.0", "boto3"] +dependencies = ["rio-tiler>=7.0,<8.0", "boto3"] [project.optional-dependencies] test = ["pytest", "pytest-cov"] diff --git a/rio_tiler_pds/copernicus/aws/dem.py b/rio_tiler_pds/copernicus/aws/dem.py index 451a131..43bbcaf 100644 --- a/rio_tiler_pds/copernicus/aws/dem.py +++ b/rio_tiler_pds/copernicus/aws/dem.py @@ -20,6 +20,7 @@ from rio_tiler.models import BandStatistics, ImageData, Info, PointData from rio_tiler.mosaic import mosaic_point_reader, mosaic_reader from rio_tiler.types import BBox +from rio_tiler.utils import CRS_to_uri @attr.s @@ -107,9 +108,8 @@ def _reader(asset: str, lon: float, lat: float, **kwargs) -> PointData: def info(self) -> Info: """info.""" meta = { - "bounds": self.geographic_bounds, - "minzoom": self.minzoom, - "maxzoom": self.maxzoom, + "bounds": self.bounds, + "crs": CRS_to_uri(self.crs) or self.crs.to_wkt(), "band_metadata": [("b1", {})], "band_descriptions": [("b1", "")], "dtype": "float32", diff --git a/tests/test_copernicus_dem.py b/tests/test_copernicus_dem.py index dd75bee..4508c78 100644 --- a/tests/test_copernicus_dem.py +++ b/tests/test_copernicus_dem.py @@ -7,6 +7,7 @@ import morecantile import pytest import rasterio +from rasterio.crs import CRS from rio_tiler_pds.copernicus.aws import Dem30Reader, Dem90Reader @@ -53,11 +54,12 @@ def test_Dem30Reader(rio): assert dem.minzoom == 7 assert dem.maxzoom == 8 assert dem.bounds == (-180, -90, 180, 90) - assert dem.geographic_bounds == (-180, -90, 180, 90) + assert dem.get_geographic_bounds(CRS.from_epsg(4326)) == (-180, -90, 180, 90) info = dem.info() - assert info.minzoom == 7 - assert info.maxzoom == 8 + assert info.bounds == dem.bounds + crs = info.crs + assert CRS.from_user_input(crs) == dem.crs assert dem.statistics()["b1"] @@ -147,11 +149,12 @@ def test_Dem90Reader(rio): assert dem.minzoom == 6 assert dem.maxzoom == 7 assert dem.bounds == (-180, -90, 180, 90) - assert dem.geographic_bounds == (-180, -90, 180, 90) + assert dem.get_geographic_bounds(CRS.from_epsg(4326)) == (-180, -90, 180, 90) info = dem.info() - assert info.minzoom == 6 - assert info.maxzoom == 7 + assert info.bounds == dem.bounds + crs = info.crs + assert CRS.from_user_input(crs) == dem.crs assert dem.statistics()["b1"]