diff --git a/pyproject.toml b/pyproject.toml index 5fc0f8b..39726d0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,7 +22,7 @@ classifiers = [ keywords = ["geotiff", "tiff", "async", "cog", "raster", "gis"] dependencies = [ "affine>=2.4.0", - "async-tiff>=0.6.0", + "async-tiff>=0.7.0", "defusedxml>=0.7.1", "numpy>=2.0", "pyproj>=3.3.0", diff --git a/src/async_geotiff/_colorinterp.py b/src/async_geotiff/_colorinterp.py index f798b47..02a58e5 100644 --- a/src/async_geotiff/_colorinterp.py +++ b/src/async_geotiff/_colorinterp.py @@ -4,6 +4,8 @@ from typing import TYPE_CHECKING +from async_tiff.enums import ExtraSamples + from .enums import ColorInterp, PhotometricInterpretation if TYPE_CHECKING: @@ -14,9 +16,7 @@ def infer_color_interpretation( # noqa: PLR0911 *, count: int, photometric: PhotometricInterpretation | None, - # TODO: update to enum when available in async-tiff - # https://github.com/developmentseed/async-tiff/issues/252 - extra_samples: Sequence[int], + extra_samples: Sequence[ExtraSamples], ) -> tuple[ColorInterp, ...]: """Infer colorinterp array based on GeoTIFF metadata.""" match photometric: @@ -43,7 +43,9 @@ def infer_color_interpretation( # noqa: PLR0911 # Sample = 2 means alpha, otherwise we mark it as undefined # https://web.archive.org/web/20240329145321/https://www.awaresystems.be/imaging/tiff/tifftags/extrasamples.html extra_colorinterps = [ - ColorInterp.ALPHA if sample == 2 else ColorInterp.UNDEFINED + ColorInterp.ALPHA + if sample == ExtraSamples.UnassociatedAlpha + else ColorInterp.UNDEFINED for sample in extra_samples or [] ] return ( diff --git a/uv.lock b/uv.lock index dd27939..6eede94 100644 --- a/uv.lock +++ b/uv.lock @@ -92,7 +92,7 @@ docs = [ [package.metadata] requires-dist = [ { name = "affine", specifier = ">=2.4.0" }, - { name = "async-tiff", specifier = ">=0.6.0" }, + { name = "async-tiff", specifier = ">=0.7.0" }, { name = "defusedxml", specifier = ">=0.7.1" }, { name = "morecantile", marker = "extra == 'morecantile'", specifier = ">=7.0,<8.0" }, { name = "numpy", specifier = ">=2.0" }, @@ -128,27 +128,27 @@ docs = [ [[package]] name = "async-tiff" -version = "0.6.0" +version = "0.7.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "obspec" }, ] wheels = [ - { url = "https://files.pythonhosted.org/packages/50/51/897f1c4a8dabf0ae92feb6fb1aa90f7dc0b96f786122e9ca4c90931cc0c2/async_tiff-0.6.0-cp311-abi3-macosx_10_12_x86_64.whl", hash = "sha256:8785542f49c2aec8ad683c52e45548ba46b0be14420c2ac77b510c27a5279d11", size = 4117112, upload-time = "2026-02-18T22:40:40.204Z" }, - { url = "https://files.pythonhosted.org/packages/2e/ab/a36002d4b1c9ba5e354c19dcbc92a3dc73d38b74701ec4de8745c7e130c9/async_tiff-0.6.0-cp311-abi3-macosx_11_0_arm64.whl", hash = "sha256:7ce79439663da319eb2e5ab2f666c295a952f22bf3d240e9fa19a316aa115b6a", size = 3835451, upload-time = "2026-02-18T22:40:41.614Z" }, - { url = "https://files.pythonhosted.org/packages/38/72/fdad64a5d39a1b12e5351d9b417ec58b9a48706b0a04443937781a43ed6b/async_tiff-0.6.0-cp311-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:81b6ef0ab05018b5d68c17e79adba9336825c5cfee36eb1831e0a14c052357a4", size = 4079967, upload-time = "2026-02-18T22:40:43.282Z" }, - { url = "https://files.pythonhosted.org/packages/96/a2/be98fc9fe7f5f5002ef35d598a1902f6338a073c3fae80a5386fcdbc3e09/async_tiff-0.6.0-cp311-abi3-manylinux_2_28_i686.whl", hash = "sha256:b00e444a3d490db2b6bbc87a5691727613e05fa7b7896df7540633b915958ace", size = 4172555, upload-time = "2026-02-18T22:40:44.852Z" }, - { url = "https://files.pythonhosted.org/packages/52/d1/85f0ac0946bf1310db42a0169dcad3a79142a3aa5e1fd8bd5e2a0e515f1d/async_tiff-0.6.0-cp311-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:6d593c122f442709361512150a79ddb09928cf104c2dec804601eecbfbfca9d6", size = 4331570, upload-time = "2026-02-18T22:40:46.284Z" }, - { url = "https://files.pythonhosted.org/packages/0b/d9/9b29749e3725264443b629ab7a6cf23a39437bfd8b6a2a48d6d6a0a8eb38/async_tiff-0.6.0-cp311-abi3-musllinux_1_2_i686.whl", hash = "sha256:fd6b7181746badfec07998bf2270cfd42b329628d809a496aa27473c98b55aa8", size = 4200946, upload-time = "2026-02-18T22:40:47.55Z" }, - { url = "https://files.pythonhosted.org/packages/a0/e0/8a66820cde1bf4d1715c271f3fafac418d1d55bcc4fcbe327ceea029d8db/async_tiff-0.6.0-cp311-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:11aab2cc238a8d684bd32f8039eb7faafc4d2e4f003415d9607a5b5ad94dba03", size = 4466569, upload-time = "2026-02-18T22:40:48.964Z" }, - { url = "https://files.pythonhosted.org/packages/22/96/856d0657cb1df3cf84ec141786a54f8609458adaa3ad3bee1181d9da7d67/async_tiff-0.6.0-cp311-abi3-win_amd64.whl", hash = "sha256:af69288b5c8e7fab6dd3d2278c1ea583048c412a5f64b241e7891145145be24d", size = 4092696, upload-time = "2026-02-18T22:40:50.341Z" }, - { url = "https://files.pythonhosted.org/packages/09/73/51e0245646e969909ec7450248e8848a55238b0cdd2be99350303fd1196c/async_tiff-0.6.0-pp311-pypy311_pp73-macosx_10_12_x86_64.whl", hash = "sha256:91590ac31a13dabf7859ee9f1d64f6c8fbd2e547196645523cb412300ec3b0cf", size = 4113628, upload-time = "2026-02-18T22:40:52.326Z" }, - { url = "https://files.pythonhosted.org/packages/b8/cf/034ae5c26e89e6d10888370228130d1563fd3ff3f9263a437e83bf28f571/async_tiff-0.6.0-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:cd124e3cd558c9492cae322da9d1010edf197dc5f0a02e4abc689f8fce93e2ad", size = 3834730, upload-time = "2026-02-18T22:40:53.643Z" }, - { url = "https://files.pythonhosted.org/packages/ee/e0/54bf26132e59bb40cce4b0ef27c6a055308d5527048c94ecbe124baa2d90/async_tiff-0.6.0-pp311-pypy311_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:1cc547099bf3f0116c972fd2eb4137cb6b3d668702d1eed82e1fbc212b442987", size = 4080495, upload-time = "2026-02-18T22:40:55.207Z" }, - { url = "https://files.pythonhosted.org/packages/91/3f/b2b11bceacf2268b156405b96cdee9922dcc32927f9d72daa9013418b907/async_tiff-0.6.0-pp311-pypy311_pp73-manylinux_2_28_i686.whl", hash = "sha256:9b6ba557d1825148d7e5c77a52f1f67230382cf380b1a383cb9e9d9de626bc51", size = 4168155, upload-time = "2026-02-18T22:40:56.634Z" }, - { url = "https://files.pythonhosted.org/packages/4e/98/e8913fd14c5b3baf86176ca6fd02476879298a0b0fb5d1062a9a904ef861/async_tiff-0.6.0-pp311-pypy311_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:29e6de432defb62b4f06c65690c3f33e8f33d7dc03754a3dbe3aaf274ec9459f", size = 4325695, upload-time = "2026-02-18T22:40:58.027Z" }, - { url = "https://files.pythonhosted.org/packages/11/b4/e5c4ebb53a77cf723e911e45ef53a79d157624f0dd035d2b18ee222dd9b6/async_tiff-0.6.0-pp311-pypy311_pp73-musllinux_1_2_i686.whl", hash = "sha256:81c32e193262c26ab9b2d841cfccbe697cb1f3a2d642db4ac3563614c2728a77", size = 4195401, upload-time = "2026-02-18T22:40:59.404Z" }, - { url = "https://files.pythonhosted.org/packages/0f/23/ce11f3d2bfe1878f14f4704006dd395c7f74ab3735c026b7f455b949e26d/async_tiff-0.6.0-pp311-pypy311_pp73-musllinux_1_2_x86_64.whl", hash = "sha256:3e5b6e196d542597e91501bcff8bf15041fa60dd46ce026400949f14c8f08f27", size = 4461824, upload-time = "2026-02-18T22:41:01.471Z" }, + { url = "https://files.pythonhosted.org/packages/7c/7a/ff9e1887b4090132c7942ec097e0718c836261ed7f97ebf3e3b7bc750709/async_tiff-0.7.0-cp311-abi3-macosx_10_12_x86_64.whl", hash = "sha256:839c2d2d9d4601cc60f0464277496a973e01ef49b83f8ed54fa71198ff8ed804", size = 4122698, upload-time = "2026-03-03T22:32:58.252Z" }, + { url = "https://files.pythonhosted.org/packages/45/23/5364c7119037ecd9d9cf78d1a1b3cbfcdf0458a2575504ca7062f0b14d31/async_tiff-0.7.0-cp311-abi3-macosx_11_0_arm64.whl", hash = "sha256:77ef4c8cb78fbe58c3e1db5449ed67d6b17d3c91bd6a6fdb8cf436d40ca15a01", size = 3841578, upload-time = "2026-03-03T22:32:59.507Z" }, + { url = "https://files.pythonhosted.org/packages/f5/01/000364b81f67b126e080e955ebb1d4267f438a925a356a7a09ce3b495705/async_tiff-0.7.0-cp311-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:2953aa02f79b046455526aa8f52e0e8dcf5c1a7a702fc830da163a68a4840577", size = 4088525, upload-time = "2026-03-03T22:33:01.625Z" }, + { url = "https://files.pythonhosted.org/packages/c6/ba/b6b84d87f9d4970e325ccadd2a976f5c143da1e03bbda7cb28ab8a83d478/async_tiff-0.7.0-cp311-abi3-manylinux_2_28_i686.whl", hash = "sha256:2a9c46292d1874c2aabc0f8c76bbcdeb74043f98296e6c50c2ea53c14d0fc023", size = 4178742, upload-time = "2026-03-03T22:33:02.925Z" }, + { url = "https://files.pythonhosted.org/packages/19/1a/51311cc9dab8a2a3722d2fd4099363d83abc4891f1ddbe0415f18174e702/async_tiff-0.7.0-cp311-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:960a2dfe71b4f5d99fe5e530d4d30f90e14410860fbfbe19e23ea5a3e32d70cc", size = 4338115, upload-time = "2026-03-03T22:33:04.405Z" }, + { url = "https://files.pythonhosted.org/packages/e9/4a/0780e3a0d406b084ab3e1c79b27f231ef64fe2ddd935e63f1325f68b6d0a/async_tiff-0.7.0-cp311-abi3-musllinux_1_2_i686.whl", hash = "sha256:25d8d92f8704a82085e17adc8d588669c24d3e02b0249f715b4b04bbbc74e632", size = 4205497, upload-time = "2026-03-03T22:33:05.612Z" }, + { url = "https://files.pythonhosted.org/packages/e8/38/21bed394bb7022d55cbe4b938e4c13f3c1f421a76d3571934e6afb92ab8b/async_tiff-0.7.0-cp311-abi3-musllinux_1_2_x86_64.whl", hash = "sha256:44d9d607f003ae6726baf1d3996f76e65ffb5ec4415836b654e5327cb8e9dfcd", size = 4474372, upload-time = "2026-03-03T22:33:08.652Z" }, + { url = "https://files.pythonhosted.org/packages/6e/a0/a49020134f3c8f9d974fc3143c66afe9e1320a369828973434026362d1c0/async_tiff-0.7.0-cp311-abi3-win_amd64.whl", hash = "sha256:1ce3dcc3c4f9965e850a5427432fd1eea1fa9c4448e8453b556a6e9f118fd51b", size = 4097755, upload-time = "2026-03-03T22:33:10.16Z" }, + { url = "https://files.pythonhosted.org/packages/25/6f/27b2040b974e191bdc28fd6e17fa2a001f6e4e68b21546b61c3073d5091c/async_tiff-0.7.0-pp311-pypy311_pp73-macosx_10_12_x86_64.whl", hash = "sha256:778930c050f9afa4432732a1172102696c072149a4e619fd497a2075d2008baa", size = 4118161, upload-time = "2026-03-03T22:33:11.648Z" }, + { url = "https://files.pythonhosted.org/packages/ab/a7/3accc40d440b7cf7bdc7e3d49a98a47ef510857830edf18e8d74908a3912/async_tiff-0.7.0-pp311-pypy311_pp73-macosx_11_0_arm64.whl", hash = "sha256:76dc7dd7d60371c4884f35d1e7ec54d344dcae16ef9417585d10b8a1102a5a66", size = 3842297, upload-time = "2026-03-03T22:33:13.194Z" }, + { url = "https://files.pythonhosted.org/packages/92/8d/a0fc193eaf7d10085fc65d9b0694a77f1040f7e14def7dda34f73bec315b/async_tiff-0.7.0-pp311-pypy311_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:02b5a351227a4bb86c4e0d2cd0a9d96d57a8289442a1d56fb34ab332e586e607", size = 4087914, upload-time = "2026-03-03T22:33:14.453Z" }, + { url = "https://files.pythonhosted.org/packages/b0/57/e656f488cef397e611f691c28cbd93a4ff53d4afa3e621f6cf48461dcf46/async_tiff-0.7.0-pp311-pypy311_pp73-manylinux_2_28_i686.whl", hash = "sha256:e59966d16409302434f2f38f6ef0b0f6c04400e4ca9113243ade65c9d024ab8c", size = 4173315, upload-time = "2026-03-03T22:33:15.694Z" }, + { url = "https://files.pythonhosted.org/packages/f4/f9/e82c5cbe73ede031b2ca4dbd88856fdca9660c8d727560b6240630fa9da6/async_tiff-0.7.0-pp311-pypy311_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:a18b8ca49d697ad4d014be2d3274241f63b4fe9cc12c3fb5595d3c8003194c6e", size = 4331034, upload-time = "2026-03-03T22:33:16.998Z" }, + { url = "https://files.pythonhosted.org/packages/0a/a1/1ee3b888772c28df8902665c8147385ff8110da88cfd1e0c02bc082843a2/async_tiff-0.7.0-pp311-pypy311_pp73-musllinux_1_2_i686.whl", hash = "sha256:b2c7652467f187689675474c953488485d712b2c3cf4bbb98016fcf2f2a95804", size = 4201299, upload-time = "2026-03-03T22:33:18.403Z" }, + { url = "https://files.pythonhosted.org/packages/03/40/50fb8ede114c44eb05b467d508c7d61bbe70f0425c141fc0b08e34944ebe/async_tiff-0.7.0-pp311-pypy311_pp73-musllinux_1_2_x86_64.whl", hash = "sha256:3e54670934f88e730433c4bd802439805c28152df8ee4ae7df7e5dc36c4b5944", size = 4468348, upload-time = "2026-03-03T22:33:19.711Z" }, ] [[package]]