diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7fa63580..9ebb893a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [3.6, 3.7, 3.8, 3.9] + python-version: [3.7, 3.8, 3.9] steps: - uses: actions/checkout@v2 diff --git a/CHANGES.md b/CHANGES.md index 28807c9e..b678fc57 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,10 @@ +# 3.0.0 (TDB) + +**breaking changes** + +* update morecantile requirement to version >=3.0 (https://github.com/cogeotiff/rio-tiler/pull/418) +* remove python 3.6 support (https://github.com/cogeotiff/rio-tiler/pull/418) + # 2.1.2 (2021-08-10) * update type information for mosaics functions (https://github.com/cogeotiff/rio-tiler/pull/409) diff --git a/rio_tiler/io/base.py b/rio_tiler/io/base.py index 6431b000..ad03542c 100644 --- a/rio_tiler/io/base.py +++ b/rio_tiler/io/base.py @@ -70,7 +70,7 @@ def tile_exists(self, tile_z: int, tile_x: int, tile_y: int) -> bool: """ tile = Tile(x=tile_x, y=tile_y, z=tile_z) - tile_bounds = self.tms.bounds(*tile) + tile_bounds = self.tms.bounds(tile) return ( (tile_bounds[0] < self.bounds[2]) and (tile_bounds[2] > self.bounds[0]) diff --git a/rio_tiler/io/cogeo.py b/rio_tiler/io/cogeo.py index db71bb1d..a7e62d11 100644 --- a/rio_tiler/io/cogeo.py +++ b/rio_tiler/io/cogeo.py @@ -128,10 +128,10 @@ def __exit__(self, exc_type, exc_value, traceback): def get_zooms(self, tilesize: int = 256) -> Tuple[int, int]: """Calculate raster min/max zoom level.""" - if self.dataset.crs != self.tms.crs: + if self.dataset.crs != self.tms.rasterio_crs: dst_affine, w, h = calculate_default_transform( self.dataset.crs, - self.tms.crs, + self.tms.rasterio_crs, self.dataset.width, self.dataset.height, *self.dataset.bounds, @@ -281,7 +281,7 @@ def tile( f"Tile {tile_z}/{tile_x}/{tile_y} is outside {self.filepath} bounds" ) - tile_bounds = self.tms.xy_bounds(*Tile(x=tile_x, y=tile_y, z=tile_z)) + tile_bounds = self.tms.xy_bounds(Tile(x=tile_x, y=tile_y, z=tile_z)) if tile_buffer: x_res = (tile_bounds[2] - tile_bounds[0]) / tilesize y_res = (tile_bounds[3] - tile_bounds[1]) / tilesize @@ -295,7 +295,7 @@ def tile( return self.part( tile_bounds, - dst_crs=self.tms.crs, + dst_crs=self.tms.rasterio_crs, bounds_crs=None, height=tilesize, width=tilesize, diff --git a/setup.py b/setup.py index 47f1ab8d..afc953c7 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ "boto3", "numexpr", "numpy", - "morecantile>=2.1,<2.2", + "morecantile>=3.0.0a0,<3.1", "pydantic", "pystac>=0.5.3", "rasterio>=1.1.7", @@ -21,13 +21,19 @@ ] extra_reqs = { - "test": ["pytest", "pytest-asyncio", "pytest-benchmark", "pytest-cov", "rio-cogeo"], + "test": [ + "pytest", + "pytest-asyncio", + "pytest-benchmark", + "pytest-cov", + "rio-cogeo @ git+https://github.com/cogeotiff/rio-cogeo.git@morecantileV3", # TODO: replace with rio-cogeo>=3.0 + ], "dev": [ "pytest", "pytest-benchmark", "pytest-cov", "pytest-asyncio", - "rio-cogeo", + "rio-cogeo @ git+https://github.com/cogeotiff/rio-cogeo.git@morecantileV3", # TODO: replace with rio-cogeo>=3.0 "pre-commit", ], "docs": ["nbconvert", "mkdocs", "mkdocs-material", "pygments", "mkdocs-jupyter"], @@ -36,7 +42,7 @@ setup( name="rio-tiler", version="2.1.2", - python_requires=">=3.6", + python_requires=">=3.7", description="User friendly Rasterio plugin to read raster datasets.", long_description=readme, long_description_content_type="text/markdown", @@ -47,7 +53,6 @@ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.6", "Topic :: Scientific/Engineering :: GIS", ], keywords="cog cogeotiff raster map tiles gdal rasterio raster-processing slippy-map", diff --git a/tests/fixtures/cog_cmap.tif b/tests/fixtures/cog_cmap.tif index 7cb1ffc5..f2825207 100644 Binary files a/tests/fixtures/cog_cmap.tif and b/tests/fixtures/cog_cmap.tif differ diff --git a/tests/fixtures/cog_dateline.tif b/tests/fixtures/cog_dateline.tif index f146136e..27918301 100644 Binary files a/tests/fixtures/cog_dateline.tif and b/tests/fixtures/cog_dateline.tif differ diff --git a/tests/test_io_cogeo.py b/tests/test_io_cogeo.py index 4cd60058..ec3a037d 100644 --- a/tests/test_io_cogeo.py +++ b/tests/test_io_cogeo.py @@ -173,7 +173,21 @@ def test_metadata_valid(): with COGReader(COG_CMAP) as cog: assert cog.colormap b1_stats = cog.metadata().statistics["1"] - assert b1_stats.histogram[1] == list(range(20)) + assert b1_stats.histogram[1] == [ + 0.0, + 1.0, + 2.0, + 3.0, + 4.0, + 5.0, + 6.0, + 7.0, + 8.0, + 10.0, + 11.0, + 12.0, + 13.0, + ] def test_tile_valid_default(): @@ -655,10 +669,10 @@ def test_tile_read_extmask(): def test_dateline(): """Read tile from data crossing the antimeridian.""" with COGReader(COG_DLINE) as cog: - img = cog.tile(1, 42, 7, tilesize=64) + img = cog.tile(0, 84, 8, tilesize=64) assert img.data.shape == (1, 64, 64) - img = cog.tile(127, 42, 7, tilesize=64) + img = cog.tile(255, 84, 8, tilesize=64) assert img.data.shape == (1, 64, 64) diff --git a/tests/test_reader.py b/tests/test_reader.py index dfc9c0ba..e3f490db 100644 --- a/tests/test_reader.py +++ b/tests/test_reader.py @@ -379,18 +379,6 @@ def test_point(): with pytest.raises(PointOutsideBounds): reader.point(src_dst, [810000, 4100000], coord_crs=src_dst.crs) - with rasterio.open(COG_CMAP) as src_dst: - # Should return None when reading masked pixel - assert not reader.point(src_dst, [-95.530, 19.8882])[0] - - # Should return value when not using Masked - assert reader.point(src_dst, [-95.530, 19.8882], masked=False)[0] == 0 - - # Checking nodata overwrite - assert ( - reader.point(src_dst, [-95.530, 19.8882], masked=True, nodata=100)[0] == 0 - ) - with rasterio.open(S3_MASK_PATH) as src_dst: # Test with COG + internal mask assert not reader.point(src_dst, [-104.7753105, 38.953548])[0] @@ -406,7 +394,7 @@ def test_metadata(): """Should return correct metadata.""" with rasterio.open(COG_CMAP) as src_dst: meta = reader.metadata(src_dst) - assert meta["dtype"] == "int8" + assert meta["dtype"] == "uint8" assert meta["colorinterp"] == ["palette"] assert not meta.get("scale") assert not meta.get("ofsset") diff --git a/tox.ini b/tox.ini index b59aab9d..2c5d58a3 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py36,py37,py38,p39 +envlist = py37,py38,p39 [testenv] extras = test